@100mslive/roomkit-react 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +1 -0
- package/dist/Accordion/Accordion.d.ts +964 -0
- package/dist/Accordion/index.d.ts +979 -0
- package/dist/ActiveSpeakerView-H3VYXANB.js +39 -0
- package/dist/ActiveSpeakerView-H3VYXANB.js.map +7 -0
- package/dist/ActiveSpeakerView-REZLWPPI.css +11 -0
- package/dist/ActiveSpeakerView-REZLWPPI.css.map +7 -0
- package/dist/AudioLevel/AudioLevel.d.ts +8 -0
- package/dist/AudioLevel/index.d.ts +1 -0
- package/dist/Avatar/Avatar.d.ts +487 -0
- package/dist/Avatar/getAvatarBg.d.ts +7 -0
- package/dist/Avatar/index.d.ts +1 -0
- package/dist/Button/Button.d.ts +488 -0
- package/dist/Button/index.d.ts +1 -0
- package/dist/Checkbox/Checkbox.d.ts +958 -0
- package/dist/Checkbox/index.d.ts +1 -0
- package/dist/Collapsible/Collapsible.d.ts +1434 -0
- package/dist/Collapsible/index.d.ts +1 -0
- package/dist/Divider/Divider.d.ts +958 -0
- package/dist/Divider/index.d.ts +1 -0
- package/dist/Dropdown/Dropdown.d.ts +5728 -0
- package/dist/Dropdown/index.d.ts +1 -0
- package/dist/Fieldset/Fieldset.d.ts +477 -0
- package/dist/Fieldset/index.d.ts +1 -0
- package/dist/Footer/Footer.d.ts +3834 -0
- package/dist/Footer/index.d.ts +1 -0
- package/dist/HLSView-3RDXRV7Y.js +689 -0
- package/dist/HLSView-3RDXRV7Y.js.map +7 -0
- package/dist/HLSView-6BVBCQM7.css +11 -0
- package/dist/HLSView-6BVBCQM7.css.map +7 -0
- package/dist/IconButton/IconButton.d.ts +479 -0
- package/dist/IconButton/index.d.ts +1 -0
- package/dist/Input/Input.d.ts +2917 -0
- package/dist/Input/index.d.ts +1 -0
- package/dist/Label/Label.d.ts +479 -0
- package/dist/Label/index.d.ts +1 -0
- package/dist/Layout/Box.d.ts +477 -0
- package/dist/Layout/Flex.d.ts +482 -0
- package/dist/Layout/index.d.ts +2 -0
- package/dist/Link/Link.d.ts +489 -0
- package/dist/Link/index.d.ts +2 -0
- package/dist/Loading/Loading.d.ts +14 -0
- package/dist/Loading/index.d.ts +1 -0
- package/dist/Modal/Dialog.d.ts +3826 -0
- package/dist/Modal/DialogContent.d.ts +3343 -0
- package/dist/Modal/index.d.ts +1 -0
- package/dist/Pagination/StyledPagination.d.ts +1918 -0
- package/dist/Pagination/index.d.ts +1 -0
- package/dist/PinnedTrackView-453PELNU.js +70 -0
- package/dist/PinnedTrackView-453PELNU.js.map +7 -0
- package/dist/PinnedTrackView-QQ5FDXJX.css +11 -0
- package/dist/PinnedTrackView-QQ5FDXJX.css.map +7 -0
- package/dist/Popover/index.d.ts +1436 -0
- package/dist/Progress/index.d.ts +957 -0
- package/dist/QRCode/QRCode.d.ts +3 -0
- package/dist/QRCode/index.d.ts +1 -0
- package/dist/RadioGroup/RadioGroup.d.ts +1435 -0
- package/dist/RadioGroup/index.d.ts +1 -0
- package/dist/ReactSelect/ReactSelect.d.ts +4778 -0
- package/dist/ReactSelect/index.d.ts +1 -0
- package/dist/Select/Select.d.ts +1437 -0
- package/dist/Select/index.d.ts +1 -0
- package/dist/Slider/Slider.d.ts +488 -0
- package/dist/Slider/index.d.ts +1 -0
- package/dist/Stats/Stats.d.ts +19 -0
- package/dist/Stats/StyledStats.d.ts +2872 -0
- package/dist/Stats/formatBytes.d.ts +1 -0
- package/dist/Stats/index.d.ts +1 -0
- package/dist/Switch/Switch.d.ts +482 -0
- package/dist/Switch/index.d.ts +1 -0
- package/dist/Tabs/Tabs.d.ts +1912 -0
- package/dist/Tabs/index.d.ts +1 -0
- package/dist/Text/Text.d.ts +605 -0
- package/dist/Text/index.d.ts +1 -0
- package/dist/Theme/ThemeProvider.d.ts +397 -0
- package/dist/Theme/base.config.d.ts +417 -0
- package/dist/Theme/index.d.ts +3 -0
- package/dist/Theme/stitches.config.d.ts +4702 -0
- package/dist/Theme/themes.d.ts +64 -0
- package/dist/Theme/useSSR.d.ts +6 -0
- package/dist/TileMenu/StyledMenuTile.d.ts +3351 -0
- package/dist/TileMenu/TileMenu.d.ts +6 -0
- package/dist/TileMenu/index.d.ts +1 -0
- package/dist/Toast/Toast.d.ts +2881 -0
- package/dist/Toast/index.d.ts +1 -0
- package/dist/Tooltip/Tooltip.d.ts +14 -0
- package/dist/Tooltip/index.d.ts +1 -0
- package/dist/Video/Video.d.ts +499 -0
- package/dist/Video/index.d.ts +1 -0
- package/dist/VideoList/StyledVideoList.d.ts +1438 -0
- package/dist/VideoList/index.d.ts +2 -0
- package/dist/VideoList/videoListUtils.d.ts +1 -0
- package/dist/VideoTile/StyledVideoTile.d.ts +4309 -0
- package/dist/VideoTile/index.d.ts +1 -0
- package/dist/VirtualBackground-LHYBWUT5.js +158 -0
- package/dist/VirtualBackground-LHYBWUT5.js.map +7 -0
- package/dist/chunk-7YUYZ64D.js +6843 -0
- package/dist/chunk-7YUYZ64D.js.map +7 -0
- package/dist/chunk-HCAGFNXW.js +8270 -0
- package/dist/chunk-HCAGFNXW.js.map +7 -0
- package/dist/chunk-KYYP6ZVK.js +907 -0
- package/dist/chunk-KYYP6ZVK.js.map +7 -0
- package/dist/chunk-ULXGBUSC.js +65 -0
- package/dist/chunk-ULXGBUSC.js.map +7 -0
- package/dist/chunk-XRJXE6UO.js +243 -0
- package/dist/chunk-XRJXE6UO.js.map +7 -0
- package/dist/conference-IDNRO4WK.js +3812 -0
- package/dist/conference-IDNRO4WK.js.map +7 -0
- package/dist/conference-KN6OKGDU.css +11 -0
- package/dist/conference-KN6OKGDU.css.map +7 -0
- package/dist/fixtures/chats.d.ts +4 -0
- package/dist/fixtures/peers.d.ts +3 -0
- package/dist/fixtures/tracks.d.ts +2 -0
- package/dist/index.cjs.css +11 -0
- package/dist/index.cjs.css.map +7 -0
- package/dist/index.cjs.js +22987 -0
- package/dist/index.cjs.js.map +7 -0
- package/dist/index.css +11 -0
- package/dist/index.css.map +7 -0
- package/dist/index.d.ts +38 -0
- package/dist/index.js +133 -0
- package/dist/index.js.map +7 -0
- package/dist/meta.cjs.json +13085 -0
- package/dist/meta.esbuild.json +13693 -0
- package/dist/transcription-BTSB7FZH.js +356 -0
- package/dist/transcription-BTSB7FZH.js.map +7 -0
- package/dist/utils/animations.d.ts +92 -0
- package/dist/utils/index.d.ts +2 -0
- package/dist/utils/styles.d.ts +21 -0
- package/package.json +116 -0
- package/src/Accordion/Accordion.stories.tsx +50 -0
- package/src/Accordion/Accordion.tsx +88 -0
- package/src/Accordion/index.ts +8 -0
- package/src/AudioLevel/AudioLevel.tsx +34 -0
- package/src/AudioLevel/index.ts +1 -0
- package/src/Avatar/Avatar.stories.tsx +33 -0
- package/src/Avatar/Avatar.tsx +55 -0
- package/src/Avatar/getAvatarBg.ts +46 -0
- package/src/Avatar/index.ts +1 -0
- package/src/Button/Button.mdx +43 -0
- package/src/Button/Button.stories.tsx +52 -0
- package/src/Button/Button.tsx +144 -0
- package/src/Button/index.tsx +1 -0
- package/src/Chat/Chat.mdx +39 -0
- package/src/Chat/Chat.stories.tsx +39 -0
- package/src/Checkbox/Checkbox.stories.tsx +61 -0
- package/src/Checkbox/Checkbox.tsx +33 -0
- package/src/Checkbox/index.tsx +1 -0
- package/src/Collapsible/Collapsible.tsx +34 -0
- package/src/Collapsible/index.tsx +1 -0
- package/src/Divider/Divider.tsx +45 -0
- package/src/Divider/HorizontalDivider.stories.tsx +34 -0
- package/src/Divider/VerticalDivider.stories.tsx +40 -0
- package/src/Divider/index.ts +1 -0
- package/src/Dropdown/Dropdown.stories.tsx +94 -0
- package/src/Dropdown/Dropdown.tsx +142 -0
- package/src/Dropdown/index.tsx +1 -0
- package/src/Fieldset/Fieldset.stories.tsx +29 -0
- package/src/Fieldset/Fieldset.tsx +11 -0
- package/src/Fieldset/index.tsx +1 -0
- package/src/Footer/Footer.stories.tsx +61 -0
- package/src/Footer/Footer.tsx +47 -0
- package/src/Footer/index.tsx +1 -0
- package/src/IconButton/IconButton.tsx +45 -0
- package/src/IconButton/index.tsx +1 -0
- package/src/Icons/Icons.stories.mdx +10 -0
- package/src/Icons/IconsList.jsx +17 -0
- package/src/Input/Input.stories.tsx +25 -0
- package/src/Input/Input.tsx +105 -0
- package/src/Input/PasswordInput.stories.tsx +53 -0
- package/src/Input/index.tsx +1 -0
- package/src/Introduction/Integrating.stories.mdx +100 -0
- package/src/Introduction/Introduction.stories.mdx +9 -0
- package/src/Label/Label.tsx +8 -0
- package/src/Label/index.ts +1 -0
- package/src/Layout/Box.tsx +3 -0
- package/src/Layout/Flex.tsx +76 -0
- package/src/Layout/index.tsx +2 -0
- package/src/Link/Link.stories.tsx +18 -0
- package/src/Link/Link.tsx +54 -0
- package/src/Link/index.tsx +2 -0
- package/src/Loading/Loading.mdx +15 -0
- package/src/Loading/Loading.stories.tsx +37 -0
- package/src/Loading/Loading.tsx +33 -0
- package/src/Loading/index.ts +1 -0
- package/src/Modal/Dialog.mdx +19 -0
- package/src/Modal/Dialog.stories.tsx +68 -0
- package/src/Modal/Dialog.tsx +26 -0
- package/src/Modal/DialogContent.tsx +63 -0
- package/src/Modal/index.ts +1 -0
- package/src/Pagination/StyledPagination.stories.tsx +80 -0
- package/src/Pagination/StyledPagination.tsx +68 -0
- package/src/Pagination/index.tsx +1 -0
- package/src/Popover/Popover.mdx +9 -0
- package/src/Popover/Popover.stories.tsx +95 -0
- package/src/Popover/index.tsx +26 -0
- package/src/Prebuilt/App.jsx +273 -0
- package/src/Prebuilt/AppContext.jsx +21 -0
- package/src/Prebuilt/IconButton.jsx +19 -0
- package/src/Prebuilt/Prebuilt.stories.tsx +20 -0
- package/src/Prebuilt/common/PeersSorter.js +89 -0
- package/src/Prebuilt/common/constants.js +208 -0
- package/src/Prebuilt/common/hooks.js +47 -0
- package/src/Prebuilt/common/roles.js +4 -0
- package/src/Prebuilt/common/useSortedPeers.js +28 -0
- package/src/Prebuilt/common/utils.js +91 -0
- package/src/Prebuilt/components/AppData/AppData.jsx +189 -0
- package/src/Prebuilt/components/AppData/useAppConfig.js +7 -0
- package/src/Prebuilt/components/AppData/useAppLayout.js +6 -0
- package/src/Prebuilt/components/AppData/useChatState.js +18 -0
- package/src/Prebuilt/components/AppData/useSidepane.js +49 -0
- package/src/Prebuilt/components/AppData/useUISettings.js +164 -0
- package/src/Prebuilt/components/AudioLevel/BeamSpeakerLabelsLogging.jsx +16 -0
- package/src/Prebuilt/components/AudioVideoToggle.jsx +67 -0
- package/src/Prebuilt/components/AuthToken.jsx +133 -0
- package/src/Prebuilt/components/BottomActionSheet/BottomActionSheet.jsx +96 -0
- package/src/Prebuilt/components/BottomActionSheet/BottomActionSheet.stories.tsx +46 -0
- package/src/Prebuilt/components/Chat/Chat.jsx +155 -0
- package/src/Prebuilt/components/Chat/ChatBody.jsx +370 -0
- package/src/Prebuilt/components/Chat/ChatFooter.jsx +150 -0
- package/src/Prebuilt/components/Chat/ChatHeader.jsx +67 -0
- package/src/Prebuilt/components/Chat/ChatSelector.jsx +162 -0
- package/src/Prebuilt/components/Chat/useEmojiPickerStyles.js +30 -0
- package/src/Prebuilt/components/Chat/useUnreadCount.js +17 -0
- package/src/Prebuilt/components/Connection/ConnectionIndicator.jsx +80 -0
- package/src/Prebuilt/components/Connection/TileConnection.jsx +40 -0
- package/src/Prebuilt/components/Connection/connectionQualityUtils.js +39 -0
- package/src/Prebuilt/components/EmojiReaction.jsx +138 -0
- package/src/Prebuilt/components/ErrorBoundary.jsx +105 -0
- package/src/Prebuilt/components/FirstPersonDisplay.jsx +50 -0
- package/src/Prebuilt/components/Footer/ChatToggle.jsx +27 -0
- package/src/Prebuilt/components/Footer/ConferencingFooter.jsx +104 -0
- package/src/Prebuilt/components/Footer/StreamingFooter.jsx +71 -0
- package/src/Prebuilt/components/Footer.jsx +8 -0
- package/src/Prebuilt/components/FullPageProgress.jsx +11 -0
- package/src/Prebuilt/components/GoLiveButton.jsx +45 -0
- package/src/Prebuilt/components/HMSVideo/Controls.jsx +21 -0
- package/src/Prebuilt/components/HMSVideo/FullscreenButton.jsx +18 -0
- package/src/Prebuilt/components/HMSVideo/HLSAutoplayBlockedPrompt.jsx +35 -0
- package/src/Prebuilt/components/HMSVideo/HLSQualitySelector.jsx +82 -0
- package/src/Prebuilt/components/HMSVideo/HMSVIdeoUtils.js +27 -0
- package/src/Prebuilt/components/HMSVideo/HMSVideo.jsx +11 -0
- package/src/Prebuilt/components/HMSVideo/PlayButton.jsx +13 -0
- package/src/Prebuilt/components/HMSVideo/VideoProgress.jsx +77 -0
- package/src/Prebuilt/components/HMSVideo/VideoTime.jsx +31 -0
- package/src/Prebuilt/components/HMSVideo/VolumeControl.jsx +39 -0
- package/src/Prebuilt/components/HMSVideo/index.js +19 -0
- package/src/Prebuilt/components/Header/AdditionalRoomState.jsx +217 -0
- package/src/Prebuilt/components/Header/AmbientMusic.jsx +88 -0
- package/src/Prebuilt/components/Header/ConferencingHeader.jsx +29 -0
- package/src/Prebuilt/components/Header/Header.jsx +8 -0
- package/src/Prebuilt/components/Header/HeaderComponents.jsx +41 -0
- package/src/Prebuilt/components/Header/ParticipantFilter.jsx +91 -0
- package/src/Prebuilt/components/Header/ParticipantList.jsx +337 -0
- package/src/Prebuilt/components/Header/StreamActions.jsx +225 -0
- package/src/Prebuilt/components/Header/StreamingHeader.jsx +55 -0
- package/src/Prebuilt/components/Header/index.jsx +1 -0
- package/src/Prebuilt/components/HlsStatsOverlay.jsx +101 -0
- package/src/Prebuilt/components/Image.jsx +7 -0
- package/src/Prebuilt/components/Input/KeyboardInputManager.js +107 -0
- package/src/Prebuilt/components/LeaveRoom.jsx +202 -0
- package/src/Prebuilt/components/MetaActions.jsx +45 -0
- package/src/Prebuilt/components/MoreSettings/BulkRoleChangeModal.jsx +139 -0
- package/src/Prebuilt/components/MoreSettings/ChangeNameModal.jsx +92 -0
- package/src/Prebuilt/components/MoreSettings/ChangeSelfRole.jsx +67 -0
- package/src/Prebuilt/components/MoreSettings/EmbedUrl.jsx +106 -0
- package/src/Prebuilt/components/MoreSettings/FullScreenItem.jsx +29 -0
- package/src/Prebuilt/components/MoreSettings/MoreSettings.jsx +225 -0
- package/src/Prebuilt/components/MoreSettings/MuteAllModal.jsx +90 -0
- package/src/Prebuilt/components/Notifications/AutoplayBlockedModal.jsx +38 -0
- package/src/Prebuilt/components/Notifications/InitErrorModal.jsx +39 -0
- package/src/Prebuilt/components/Notifications/MessageNotifications.jsx +25 -0
- package/src/Prebuilt/components/Notifications/Notifications.jsx +151 -0
- package/src/Prebuilt/components/Notifications/PeerNotifications.jsx +45 -0
- package/src/Prebuilt/components/Notifications/PermissionErrorModal.jsx +67 -0
- package/src/Prebuilt/components/Notifications/ReconnectNotifications.jsx +69 -0
- package/src/Prebuilt/components/Notifications/TrackBulkUnmuteModal.jsx +51 -0
- package/src/Prebuilt/components/Notifications/TrackNotifications.jsx +19 -0
- package/src/Prebuilt/components/Notifications/TrackUnmuteModal.jsx +49 -0
- package/src/Prebuilt/components/Notifications/index.jsx +1 -0
- package/src/Prebuilt/components/PIP/PIPComponent.jsx +82 -0
- package/src/Prebuilt/components/PIP/PIPManager.js +296 -0
- package/src/Prebuilt/components/PIP/SetupMediaSession.js +60 -0
- package/src/Prebuilt/components/PIP/index.jsx +11 -0
- package/src/Prebuilt/components/PIP/pip.test.js +72 -0
- package/src/Prebuilt/components/PIP/pipUtils.js +183 -0
- package/src/Prebuilt/components/Pagination.jsx +29 -0
- package/src/Prebuilt/components/Playlist/Playlist.jsx +129 -0
- package/src/Prebuilt/components/Playlist/PlaylistControls.jsx +172 -0
- package/src/Prebuilt/components/Playlist/PlaylistItem.jsx +51 -0
- package/src/Prebuilt/components/Playlist/VideoPlayer.jsx +95 -0
- package/src/Prebuilt/components/PostLeave.jsx +76 -0
- package/src/Prebuilt/components/Preview/PreviewContainer.jsx +51 -0
- package/src/Prebuilt/components/Preview/PreviewJoin.jsx +196 -0
- package/src/Prebuilt/components/Preview/PreviewName.jsx +37 -0
- package/src/Prebuilt/components/RoleChangeModal.jsx +185 -0
- package/src/Prebuilt/components/RoleChangeRequestModal.jsx +26 -0
- package/src/Prebuilt/components/ScreenShare.jsx +45 -0
- package/src/Prebuilt/components/ScreenshareDisplay.jsx +45 -0
- package/src/Prebuilt/components/ScreenshareHintModal.jsx +37 -0
- package/src/Prebuilt/components/ScreenshareTile.jsx +91 -0
- package/src/Prebuilt/components/Settings/DeviceSettings.jsx +220 -0
- package/src/Prebuilt/components/Settings/LayoutSettings.jsx +91 -0
- package/src/Prebuilt/components/Settings/NotificationSettings.jsx +61 -0
- package/src/Prebuilt/components/Settings/SettingsModal.jsx +171 -0
- package/src/Prebuilt/components/Settings/StartRecording.jsx +130 -0
- package/src/Prebuilt/components/Settings/SwitchWithLabel.jsx +40 -0
- package/src/Prebuilt/components/Settings/common.js +15 -0
- package/src/Prebuilt/components/ShareMenuIcon.jsx +26 -0
- package/src/Prebuilt/components/StatsForNerds.jsx +250 -0
- package/src/Prebuilt/components/Streaming/Common.jsx +132 -0
- package/src/Prebuilt/components/Streaming/HLSStreaming.jsx +226 -0
- package/src/Prebuilt/components/Streaming/RTMPIcon.jsx +24 -0
- package/src/Prebuilt/components/Streaming/RTMPStreaming.jsx +336 -0
- package/src/Prebuilt/components/Streaming/ResolutionInput.jsx +88 -0
- package/src/Prebuilt/components/Streaming/StreamingLanding.jsx +76 -0
- package/src/Prebuilt/components/TileMenu.jsx +275 -0
- package/src/Prebuilt/components/Toast/Toast.jsx +17 -0
- package/src/Prebuilt/components/Toast/ToastBatcher.js +57 -0
- package/src/Prebuilt/components/Toast/ToastConfig.jsx +134 -0
- package/src/Prebuilt/components/Toast/ToastContainer.jsx +30 -0
- package/src/Prebuilt/components/Toast/ToastManager.js +44 -0
- package/src/Prebuilt/components/VideoList.jsx +101 -0
- package/src/Prebuilt/components/VideoTile.jsx +177 -0
- package/src/Prebuilt/components/conference.jsx +164 -0
- package/src/Prebuilt/components/gridView.jsx +85 -0
- package/src/Prebuilt/components/hooks/useDropdownList.jsx +23 -0
- package/src/Prebuilt/components/hooks/useDropdownSelection.jsx +6 -0
- package/src/Prebuilt/components/hooks/useFeatures.js +22 -0
- package/src/Prebuilt/components/hooks/useFullscreen.js +43 -0
- package/src/Prebuilt/components/hooks/useMetadata.jsx +52 -0
- package/src/Prebuilt/components/hooks/useNavigation.js +19 -0
- package/src/Prebuilt/components/hooks/usePlaylist.js +25 -0
- package/src/Prebuilt/components/hooks/usePlaylistMusic.js +35 -0
- package/src/Prebuilt/components/hooks/useScreenshareAudio.js +28 -0
- package/src/Prebuilt/components/hooks/useSetPinnedMessage.js +38 -0
- package/src/Prebuilt/components/hooks/useSkipPreview.jsx +20 -0
- package/src/Prebuilt/components/hooks/useUserPreferences.jsx +25 -0
- package/src/Prebuilt/components/init/Init.jsx +58 -0
- package/src/Prebuilt/components/init/initUtils.js +90 -0
- package/src/Prebuilt/components/pdfAnnotator/pdfErrorView.jsx +29 -0
- package/src/Prebuilt/components/pdfAnnotator/pdfFileOptions.jsx +108 -0
- package/src/Prebuilt/components/pdfAnnotator/pdfHeader.jsx +31 -0
- package/src/Prebuilt/components/pdfAnnotator/pdfInfo.jsx +32 -0
- package/src/Prebuilt/components/pdfAnnotator/shareScreenOptions.jsx +233 -0
- package/src/Prebuilt/components/pdfAnnotator/submitPdf.jsx +89 -0
- package/src/Prebuilt/components/pdfAnnotator/uploadedFile.jsx +85 -0
- package/src/Prebuilt/components/peerTileUtils.jsx +27 -0
- package/src/Prebuilt/hms.js +7 -0
- package/src/Prebuilt/images/first_person.png +0 -0
- package/src/Prebuilt/index.d.ts +15 -0
- package/src/Prebuilt/index.js +2 -0
- package/src/Prebuilt/layouts/ActiveSpeakerView.jsx +34 -0
- package/src/Prebuilt/layouts/EmbedView.jsx +141 -0
- package/src/Prebuilt/layouts/HLSView.jsx +290 -0
- package/src/Prebuilt/layouts/InsetView.jsx +222 -0
- package/src/Prebuilt/layouts/NonPublisherView.jsx +51 -0
- package/src/Prebuilt/layouts/PDFView.jsx +122 -0
- package/src/Prebuilt/layouts/PinnedTrackView.jsx +59 -0
- package/src/Prebuilt/layouts/SidePane.jsx +51 -0
- package/src/Prebuilt/layouts/WaitingView.jsx +51 -0
- package/src/Prebuilt/layouts/WhiteboardView.jsx +66 -0
- package/src/Prebuilt/layouts/mainGridView.jsx +98 -0
- package/src/Prebuilt/layouts/mainView.jsx +113 -0
- package/src/Prebuilt/layouts/screenShareView.jsx +185 -0
- package/src/Prebuilt/plugins/FlyingEmoji.jsx +132 -0
- package/src/Prebuilt/plugins/RemoteStopScreenshare.jsx +18 -0
- package/src/Prebuilt/plugins/VirtualBackground/VirtualBackground.jsx +90 -0
- package/src/Prebuilt/plugins/VirtualBackground/vbutils.js +66 -0
- package/src/Prebuilt/plugins/confetti.jsx +60 -0
- package/src/Prebuilt/plugins/transcription/Transcriber.js +216 -0
- package/src/Prebuilt/plugins/transcription/TranscriptionButton.jsx +138 -0
- package/src/Prebuilt/plugins/transcription/index.jsx +1 -0
- package/src/Prebuilt/plugins/whiteboard/PusherCommunicationProvider.js +110 -0
- package/src/Prebuilt/plugins/whiteboard/README.md +29 -0
- package/src/Prebuilt/plugins/whiteboard/ToggleWhiteboard.jsx +43 -0
- package/src/Prebuilt/plugins/whiteboard/Whiteboard.css +12 -0
- package/src/Prebuilt/plugins/whiteboard/Whiteboard.jsx +11 -0
- package/src/Prebuilt/plugins/whiteboard/WhiteboardEvents.js +8 -0
- package/src/Prebuilt/plugins/whiteboard/index.js +3 -0
- package/src/Prebuilt/plugins/whiteboard/useMultiplayerState.js +212 -0
- package/src/Prebuilt/plugins/whiteboard/useWhiteboardMetadata.js +47 -0
- package/src/Prebuilt/primitives/DialogContent.jsx +280 -0
- package/src/Prebuilt/primitives/DropdownTrigger.jsx +46 -0
- package/src/Prebuilt/services/FeatureFlags.jsx +47 -0
- package/src/Prebuilt/services/tokenService.js +49 -0
- package/src/Progress/index.tsx +17 -0
- package/src/QRCode/QRCode.mdx +9 -0
- package/src/QRCode/QRCode.stories.tsx +29 -0
- package/src/QRCode/QRCode.tsx +6 -0
- package/src/QRCode/index.tsx +1 -0
- package/src/RadioGroup/RadioGroup.stories.tsx +32 -0
- package/src/RadioGroup/RadioGroup.tsx +33 -0
- package/src/RadioGroup/index.tsx +1 -0
- package/src/ReactSelect/ReactSelect.stories.tsx +83 -0
- package/src/ReactSelect/ReactSelect.tsx +97 -0
- package/src/ReactSelect/index.ts +1 -0
- package/src/Select/Select.stories.tsx +33 -0
- package/src/Select/Select.tsx +63 -0
- package/src/Select/index.ts +1 -0
- package/src/Slider/Slider.stories.tsx +21 -0
- package/src/Slider/Slider.tsx +70 -0
- package/src/Slider/index.ts +1 -0
- package/src/Stats/Stats.tsx +211 -0
- package/src/Stats/StyledStats.tsx +57 -0
- package/src/Stats/formatBytes.ts +19 -0
- package/src/Stats/index.tsx +1 -0
- package/src/Switch/Switch.mdx +11 -0
- package/src/Switch/Switch.stories.tsx +46 -0
- package/src/Switch/Switch.tsx +52 -0
- package/src/Switch/index.ts +1 -0
- package/src/Tabs/Tabs.stories.tsx +77 -0
- package/src/Tabs/Tabs.tsx +41 -0
- package/src/Tabs/index.tsx +1 -0
- package/src/Text/Text.stories.tsx +21 -0
- package/src/Text/Text.tsx +149 -0
- package/src/Text/index.tsx +1 -0
- package/src/Theme/Theme.stories.mdx +8 -0
- package/src/Theme/ThemeProvider.tsx +104 -0
- package/src/Theme/ThemeStory.jsx +58 -0
- package/src/Theme/base.config.ts +264 -0
- package/src/Theme/index.tsx +3 -0
- package/src/Theme/stitches.config.ts +100 -0
- package/src/Theme/themes.ts +70 -0
- package/src/Theme/useSSR.tsx +24 -0
- package/src/TileMenu/StyledMenuTile.tsx +101 -0
- package/src/TileMenu/TileMenu.tsx +96 -0
- package/src/TileMenu/index.tsx +1 -0
- package/src/Toast/AppToast.stories.tsx +56 -0
- package/src/Toast/Toast.mdx +19 -0
- package/src/Toast/Toast.stories.tsx +57 -0
- package/src/Toast/Toast.tsx +168 -0
- package/src/Toast/index.tsx +1 -0
- package/src/Tooltip/Tooltip.stories.tsx +62 -0
- package/src/Tooltip/Tooltip.tsx +79 -0
- package/src/Tooltip/index.ts +1 -0
- package/src/Video/UseVideo.mdx +22 -0
- package/src/Video/UseVideo.stories.tsx +26 -0
- package/src/Video/Video.mdx +24 -0
- package/src/Video/Video.stories.tsx +27 -0
- package/src/Video/Video.tsx +61 -0
- package/src/Video/index.tsx +1 -0
- package/src/VideoList/StyledVideoList.tsx +39 -0
- package/src/VideoList/VideoList.stories.tsx +92 -0
- package/src/VideoList/index.tsx +2 -0
- package/src/VideoList/videoListUtils.tsx +20 -0
- package/src/VideoTile/StyledVideoTile.tsx +148 -0
- package/src/VideoTile/VideoTile.mdx +28 -0
- package/src/VideoTile/VideoTile.stories.tsx +32 -0
- package/src/VideoTile/index.tsx +1 -0
- package/src/fixtures/chats.ts +25 -0
- package/src/fixtures/peers.ts +24 -0
- package/src/fixtures/tracks.ts +11 -0
- package/src/index.ts +38 -0
- package/src/store/SetupFakeStore.ts +33 -0
- package/src/store/StorybookSDK.ts +229 -0
- package/src/utils/animations.ts +90 -0
- package/src/utils/index.ts +2 -0
- package/src/utils/styles.ts +22 -0
@@ -0,0 +1,88 @@
|
|
1
|
+
import React, { PropsWithChildren } from 'react';
|
2
|
+
import * as BaseAccordion from '@radix-ui/react-accordion';
|
3
|
+
import { CSS } from '@stitches/react';
|
4
|
+
import { ChevronUpIcon } from '@100mslive/react-icons';
|
5
|
+
import { Box } from '../Layout';
|
6
|
+
import { styled } from '../Theme';
|
7
|
+
import { slideDown, slideUp } from '../utils';
|
8
|
+
|
9
|
+
const StyledAccordion = styled(BaseAccordion.Root, {});
|
10
|
+
|
11
|
+
const StyledItem = styled(BaseAccordion.Item, {
|
12
|
+
marginTop: '$px',
|
13
|
+
display: 'block',
|
14
|
+
'&:first-child': {
|
15
|
+
marginTop: 0,
|
16
|
+
borderTopLeftRadius: '$0',
|
17
|
+
borderTopRightRadius: '$0',
|
18
|
+
},
|
19
|
+
'&:last-child': {
|
20
|
+
borderBottomLeftRadius: '$4',
|
21
|
+
borderBottomRightRadius: '$4',
|
22
|
+
},
|
23
|
+
});
|
24
|
+
|
25
|
+
const StyledHeader = styled(BaseAccordion.Header, {
|
26
|
+
all: 'unset',
|
27
|
+
display: 'flex',
|
28
|
+
fontFamily: '$sans',
|
29
|
+
});
|
30
|
+
|
31
|
+
const StyledTrigger = styled(BaseAccordion.Trigger, {
|
32
|
+
all: 'unset',
|
33
|
+
fontFamily: '$sans',
|
34
|
+
flex: 1,
|
35
|
+
display: 'flex',
|
36
|
+
alignItems: 'center',
|
37
|
+
justifyContent: 'space-between',
|
38
|
+
fontSize: '$md',
|
39
|
+
lineHeight: '$md',
|
40
|
+
color: '$textHighEmp',
|
41
|
+
});
|
42
|
+
|
43
|
+
const StyledContent = styled(BaseAccordion.Content, {
|
44
|
+
display: 'contents',
|
45
|
+
fontSize: '$md',
|
46
|
+
fontFamily: '$sans',
|
47
|
+
color: '$textMedEmp',
|
48
|
+
'&[data-state="open"]': {
|
49
|
+
animation: `${slideDown('--radix-accordion-content-height')} 300ms cubic-bezier(0.87, 0, 0.13, 1) forwards`,
|
50
|
+
},
|
51
|
+
'&[data-state="closed"]': {
|
52
|
+
animation: `${slideUp('--radix-accordion-content-height')} 300ms cubic-bezier(0.87, 0, 0.13, 1) forwards`,
|
53
|
+
},
|
54
|
+
});
|
55
|
+
|
56
|
+
const StyledChevron = styled(ChevronUpIcon, {
|
57
|
+
color: '$textPrimary',
|
58
|
+
transition: 'transform 300ms cubic-bezier(0.87, 0, 0.13, 1)',
|
59
|
+
'[data-state=closed] &': { transform: 'rotate(180deg)' },
|
60
|
+
});
|
61
|
+
|
62
|
+
// Exports
|
63
|
+
export const AccordionRoot = StyledAccordion;
|
64
|
+
export const AccordionItem = StyledItem;
|
65
|
+
|
66
|
+
export const AccordionHeader: React.FC<
|
67
|
+
PropsWithChildren<BaseAccordion.AccordionTriggerProps & { iconStyles?: CSS; css?: CSS }>
|
68
|
+
> = React.forwardRef<
|
69
|
+
HTMLButtonElement,
|
70
|
+
PropsWithChildren<BaseAccordion.AccordionTriggerProps & { iconStyles?: CSS; css?: CSS }>
|
71
|
+
>(({ children, iconStyles, css, ...props }, forwardedRef) => (
|
72
|
+
<StyledHeader css={css}>
|
73
|
+
<StyledTrigger {...props} ref={forwardedRef}>
|
74
|
+
{children}
|
75
|
+
<StyledChevron aria-hidden css={iconStyles} />
|
76
|
+
</StyledTrigger>
|
77
|
+
</StyledHeader>
|
78
|
+
));
|
79
|
+
|
80
|
+
export const AccordionContent: React.FC<
|
81
|
+
PropsWithChildren<BaseAccordion.AccordionContentProps & { contentStyles?: CSS }>
|
82
|
+
> = React.forwardRef<HTMLDivElement, PropsWithChildren<BaseAccordion.AccordionContentProps & { contentStyles?: CSS }>>(
|
83
|
+
({ children, contentStyles, ...props }, forwardedRef) => (
|
84
|
+
<StyledContent {...props} ref={forwardedRef}>
|
85
|
+
<Box css={contentStyles}>{children}</Box>
|
86
|
+
</StyledContent>
|
87
|
+
),
|
88
|
+
);
|
@@ -0,0 +1,34 @@
|
|
1
|
+
import { useCallback, useRef } from 'react';
|
2
|
+
import { HMSTrackID } from '@100mslive/hms-video-store';
|
3
|
+
import { useAudioLevelStyles } from '@100mslive/react-sdk';
|
4
|
+
import { useTheme } from '../Theme';
|
5
|
+
|
6
|
+
/**
|
7
|
+
* pass in a track id and get a ref. That ref can be attached to an element which will have border
|
8
|
+
* as per audio level post that.
|
9
|
+
*/
|
10
|
+
export function useBorderAudioLevel(audioTrackId?: HMSTrackID) {
|
11
|
+
const { theme } = useTheme();
|
12
|
+
const color = theme.colors.brandDefault.value;
|
13
|
+
const getStyle = useCallback(
|
14
|
+
(level: number) => {
|
15
|
+
const style: Record<string, string> = {
|
16
|
+
transition: 'outline 0.4s ease-in-out',
|
17
|
+
};
|
18
|
+
style['outline'] = level ? `${sigmoid(level) * 4}px solid ${color}` : '0px solid transparent';
|
19
|
+
return style;
|
20
|
+
},
|
21
|
+
[color],
|
22
|
+
);
|
23
|
+
const ref = useRef(null);
|
24
|
+
useAudioLevelStyles({
|
25
|
+
trackId: audioTrackId,
|
26
|
+
getStyle,
|
27
|
+
ref,
|
28
|
+
});
|
29
|
+
return ref;
|
30
|
+
}
|
31
|
+
|
32
|
+
export const sigmoid = (z: number) => {
|
33
|
+
return 1 / (1 + Math.exp(-z));
|
34
|
+
};
|
@@ -0,0 +1 @@
|
|
1
|
+
export { useBorderAudioLevel } from './AudioLevel';
|
@@ -0,0 +1,33 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import { ComponentMeta, ComponentStory } from '@storybook/react';
|
3
|
+
import { Avatar } from '.';
|
4
|
+
|
5
|
+
export default {
|
6
|
+
title: 'UI Components/Avatar',
|
7
|
+
component: Avatar,
|
8
|
+
argTypes: {
|
9
|
+
ref: { table: { disable: true } },
|
10
|
+
},
|
11
|
+
args: {
|
12
|
+
name: '100ms',
|
13
|
+
},
|
14
|
+
} as ComponentMeta<typeof Avatar>;
|
15
|
+
|
16
|
+
export const Square: ComponentStory<typeof Avatar> = args => {
|
17
|
+
return <Avatar css={{ width: '50px', height: '50px' }} shape="square" {...args} />;
|
18
|
+
};
|
19
|
+
|
20
|
+
export const Circle: ComponentStory<typeof Avatar> = args => {
|
21
|
+
return <Avatar css={{ width: '50px', height: '50px' }} shape="circle" {...args} />;
|
22
|
+
};
|
23
|
+
|
24
|
+
export const Playground = ({ height = 50, width = 50, css = {}, shape = 'circle' as const, name = '' }) => {
|
25
|
+
return <Avatar css={{ width: width, height: height, ...css }} name={name} shape={shape} />;
|
26
|
+
};
|
27
|
+
|
28
|
+
Playground.storyName = 'Avatar';
|
29
|
+
Playground.argTypes = {
|
30
|
+
height: { control: { type: 'number' } },
|
31
|
+
width: { control: { type: 'number' } },
|
32
|
+
shape: { options: ['square', 'circle'], defaultValue: 'square', control: { type: 'select' } },
|
33
|
+
};
|
@@ -0,0 +1,55 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import { VariantProps } from '@stitches/react';
|
3
|
+
import { styled } from '../Theme';
|
4
|
+
import { getAvatarBg } from './getAvatarBg';
|
5
|
+
import { flexCenter } from '../utils/styles';
|
6
|
+
|
7
|
+
const getAvatarShape = (radii: string) => ({
|
8
|
+
borderRadius: radii,
|
9
|
+
});
|
10
|
+
|
11
|
+
export const StyledAvatar = styled('div', {
|
12
|
+
...flexCenter,
|
13
|
+
color: '$white',
|
14
|
+
fontFamily: '$sans',
|
15
|
+
aspectRatio: 1,
|
16
|
+
fontWeight: 600,
|
17
|
+
fontSize: '$space$9',
|
18
|
+
variants: {
|
19
|
+
shape: {
|
20
|
+
circle: getAvatarShape('$round'),
|
21
|
+
square: getAvatarShape('$1'),
|
22
|
+
},
|
23
|
+
size: {
|
24
|
+
small: {
|
25
|
+
height: '$16 !important',
|
26
|
+
fontSize: '$space$6',
|
27
|
+
},
|
28
|
+
medium: {
|
29
|
+
height: '$18 !important',
|
30
|
+
fontSize: '$space$10',
|
31
|
+
},
|
32
|
+
large: {
|
33
|
+
height: '$20 !important',
|
34
|
+
fontSize: '$space$12',
|
35
|
+
},
|
36
|
+
},
|
37
|
+
},
|
38
|
+
defaultVariants: {
|
39
|
+
shape: 'circle',
|
40
|
+
},
|
41
|
+
});
|
42
|
+
|
43
|
+
type Props = VariantProps<typeof StyledAvatar> &
|
44
|
+
React.ComponentProps<typeof StyledAvatar> & {
|
45
|
+
name: string;
|
46
|
+
};
|
47
|
+
|
48
|
+
export const Avatar: React.FC<Props> = ({ name, css, ...props }) => {
|
49
|
+
const { initials, color } = getAvatarBg(name);
|
50
|
+
return (
|
51
|
+
<StyledAvatar css={{ bg: color, ...css }} {...props}>
|
52
|
+
{initials}
|
53
|
+
</StyledAvatar>
|
54
|
+
);
|
55
|
+
};
|
@@ -0,0 +1,46 @@
|
|
1
|
+
const getInitials = (name: string | undefined) => {
|
2
|
+
if (!name) {
|
3
|
+
return undefined;
|
4
|
+
} else {
|
5
|
+
return name
|
6
|
+
.trim()
|
7
|
+
.match(/(^\S\S?|\b\S)?/g)
|
8
|
+
?.join('')
|
9
|
+
?.match(/(^\S|\S$)?/g)
|
10
|
+
?.join('')
|
11
|
+
.toUpperCase();
|
12
|
+
}
|
13
|
+
};
|
14
|
+
|
15
|
+
/**
|
16
|
+
calculates the initials of the name and choose a background color based on the first later of the initials
|
17
|
+
*/
|
18
|
+
export const getAvatarBg = (name: string): { initials: string; color: string } => {
|
19
|
+
const initials = getInitials(name);
|
20
|
+
const indexFactor = 20;
|
21
|
+
const colorIndex = ((initials?.codePointAt(0) || 0) % indexFactor) + 1;
|
22
|
+
return { initials: initials || '', color: colorsList[colorIndex - 1] };
|
23
|
+
};
|
24
|
+
|
25
|
+
const colorsList = [
|
26
|
+
'#616161',
|
27
|
+
'#F44336',
|
28
|
+
'#3F51B5',
|
29
|
+
'#4CAF50',
|
30
|
+
'#FFA000',
|
31
|
+
'#795548',
|
32
|
+
'#E91E63',
|
33
|
+
'#2F80FF',
|
34
|
+
'#8BC34A',
|
35
|
+
'#F57C00',
|
36
|
+
'#4E342E',
|
37
|
+
'#9C27B0',
|
38
|
+
'#00BCD4',
|
39
|
+
'#C0CA33',
|
40
|
+
'#F4511E',
|
41
|
+
'#673AB7',
|
42
|
+
'#009688',
|
43
|
+
'#FBC02D',
|
44
|
+
'#BF360C',
|
45
|
+
'#455A64',
|
46
|
+
];
|
@@ -0,0 +1 @@
|
|
1
|
+
export { Avatar, StyledAvatar } from './Avatar';
|
@@ -0,0 +1,43 @@
|
|
1
|
+
import { Story, Props, Preview } from '@storybook/addon-docs';
|
2
|
+
|
3
|
+
import { Button } from '.';
|
4
|
+
import { HangUpIcon } from '@100mslive/react-icons';
|
5
|
+
|
6
|
+
## Button
|
7
|
+
|
8
|
+
The button has three possible variants,
|
9
|
+
|
10
|
+
- Primary,
|
11
|
+
- Standard, and
|
12
|
+
- Danger
|
13
|
+
|
14
|
+
Button can also have an icon, you can add the icon as a children of that Button. The `icon` attribute will add a padding
|
15
|
+
between those children elements.
|
16
|
+
|
17
|
+
A Button also have an attribute `outlined` which will add an outline to that Button.
|
18
|
+
|
19
|
+
### Primary
|
20
|
+
|
21
|
+
<Preview>
|
22
|
+
<Story id="ui-components-button--primary" />
|
23
|
+
</Preview>
|
24
|
+
|
25
|
+
### Standard
|
26
|
+
|
27
|
+
<Preview>
|
28
|
+
<Story id="ui-components-button--standard" />
|
29
|
+
</Preview>
|
30
|
+
|
31
|
+
### Danger
|
32
|
+
|
33
|
+
<Preview>
|
34
|
+
<Story id="ui-components-button--danger" />
|
35
|
+
</Preview>
|
36
|
+
|
37
|
+
### With Icon
|
38
|
+
|
39
|
+
<Preview>
|
40
|
+
<Story id="ui-components-button--with-icon" />
|
41
|
+
</Preview>
|
42
|
+
|
43
|
+
<Props />
|
@@ -0,0 +1,52 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import { ComponentMeta, ComponentStory } from '@storybook/react';
|
3
|
+
import { HangUpIcon } from '@100mslive/react-icons';
|
4
|
+
import { Button } from './Button';
|
5
|
+
import mdx from './Button.mdx';
|
6
|
+
|
7
|
+
export default {
|
8
|
+
title: 'UI Components/Button',
|
9
|
+
component: Button,
|
10
|
+
argTypes: {
|
11
|
+
variant: {
|
12
|
+
description: 'Button styled variants',
|
13
|
+
},
|
14
|
+
outlined: { description: 'Give button an outlined style' },
|
15
|
+
icon: { description: 'Give space between children' },
|
16
|
+
loading: { description: 'Button is in a loading state' },
|
17
|
+
},
|
18
|
+
parameters: {
|
19
|
+
docs: {
|
20
|
+
page: mdx,
|
21
|
+
},
|
22
|
+
},
|
23
|
+
} as ComponentMeta<typeof Button>;
|
24
|
+
|
25
|
+
export const Primary = () => <Button variant="primary">Hello, World</Button>;
|
26
|
+
|
27
|
+
export const Standard = () => <Button variant="standard">Hello, World</Button>;
|
28
|
+
|
29
|
+
export const Danger = () => <Button variant="danger">Hello, World</Button>;
|
30
|
+
|
31
|
+
export const WithIcon = () => (
|
32
|
+
<Button variant="danger" icon>
|
33
|
+
<HangUpIcon />
|
34
|
+
Leave Room
|
35
|
+
</Button>
|
36
|
+
);
|
37
|
+
|
38
|
+
export const Playground: ComponentStory<typeof Button> = args => <Button {...args}>Hello World</Button>;
|
39
|
+
|
40
|
+
Playground.storyName = 'Button';
|
41
|
+
Playground.argTypes = {
|
42
|
+
onClick: { action: 'clicked' },
|
43
|
+
variant: {
|
44
|
+
control: {
|
45
|
+
type: 'select',
|
46
|
+
options: ['primary', 'standard', 'danger'],
|
47
|
+
},
|
48
|
+
},
|
49
|
+
outlined: { control: 'boolean' },
|
50
|
+
icon: { control: 'boolean' },
|
51
|
+
loading: { control: 'boolean' },
|
52
|
+
};
|
@@ -0,0 +1,144 @@
|
|
1
|
+
import React, { ComponentPropsWithRef, PropsWithChildren } from 'react';
|
2
|
+
import { Flex } from '../Layout';
|
3
|
+
import { Loading } from '../Loading';
|
4
|
+
import { styled } from '../Theme';
|
5
|
+
import { flexCenter } from '../utils/styles';
|
6
|
+
|
7
|
+
/**
|
8
|
+
* @param base bg color
|
9
|
+
* @param hover hover state bg color
|
10
|
+
* @param active active state bg color
|
11
|
+
* @returns CSS object based on the state
|
12
|
+
*/
|
13
|
+
|
14
|
+
const getOutlinedVariants = (base: string, hover: string, active: string, disabled: string) => {
|
15
|
+
return {
|
16
|
+
bg: '$transparent',
|
17
|
+
border: `solid $space$px ${base}`,
|
18
|
+
c: '$textHighEmp',
|
19
|
+
'&[disabled]': {
|
20
|
+
c: '$textAccentDisabled',
|
21
|
+
bg: '$transparent',
|
22
|
+
border: `solid $space$px ${disabled}`,
|
23
|
+
cursor: 'not-allowed',
|
24
|
+
},
|
25
|
+
'&:not([disabled]):hover': {
|
26
|
+
border: `solid $space$px ${hover}`,
|
27
|
+
bg: '$transparent',
|
28
|
+
},
|
29
|
+
'&:not([disabled]):active': {
|
30
|
+
border: `solid $space$px ${active}`,
|
31
|
+
bg: '$transparent',
|
32
|
+
},
|
33
|
+
'&:not([disabled]):focus-visible': {
|
34
|
+
boxShadow: `0 0 0 3px ${base}`,
|
35
|
+
},
|
36
|
+
};
|
37
|
+
};
|
38
|
+
|
39
|
+
const getButtonVariants = (base: string, hover: string, active: string, disabled: string) => {
|
40
|
+
return {
|
41
|
+
bg: base,
|
42
|
+
border: `1px solid ${base}`,
|
43
|
+
c: '$textAccentHigh',
|
44
|
+
'&[disabled]': {
|
45
|
+
c: '$textAccentDisabled',
|
46
|
+
cursor: 'not-allowed',
|
47
|
+
bg: disabled,
|
48
|
+
border: `1px solid ${disabled}`,
|
49
|
+
},
|
50
|
+
'&:not([disabled]):hover': {
|
51
|
+
bg: hover,
|
52
|
+
border: `1px solid ${hover}`,
|
53
|
+
},
|
54
|
+
'&:not([disabled]):active': {
|
55
|
+
bg: active,
|
56
|
+
border: `1px solid ${active}`,
|
57
|
+
},
|
58
|
+
'&:not([disabled]):focus-visible': {
|
59
|
+
boxShadow: `0 0 0 3px ${base}`,
|
60
|
+
},
|
61
|
+
};
|
62
|
+
};
|
63
|
+
|
64
|
+
const StyledButton = styled('button', {
|
65
|
+
...flexCenter,
|
66
|
+
cursor: 'pointer',
|
67
|
+
fontFamily: '$sans',
|
68
|
+
lineHeight: 'inherit',
|
69
|
+
textTransform: 'none',
|
70
|
+
position: 'relative',
|
71
|
+
outline: 'none',
|
72
|
+
border: 'none',
|
73
|
+
fs: '$md',
|
74
|
+
r: '$1',
|
75
|
+
backgroundColor: '$primaryDefault',
|
76
|
+
fontWeight: '500',
|
77
|
+
whiteSpace: 'nowrap',
|
78
|
+
p: '$4 $8',
|
79
|
+
'-webkit-appearance': 'button',
|
80
|
+
'&:focus': {
|
81
|
+
outline: 'none',
|
82
|
+
},
|
83
|
+
'&:not([disabled]):focus-visible': {
|
84
|
+
boxShadow: '0 0 0 3px $colors$primaryDefault',
|
85
|
+
},
|
86
|
+
transition: 'all 0.2s ease',
|
87
|
+
compoundVariants: [
|
88
|
+
{
|
89
|
+
variant: 'standard',
|
90
|
+
outlined: true,
|
91
|
+
css: getOutlinedVariants('$secondaryDefault', '$secondaryLight', '$secondaryDark', '$secondaryDisabled'),
|
92
|
+
},
|
93
|
+
{
|
94
|
+
variant: 'danger',
|
95
|
+
outlined: true,
|
96
|
+
css: getOutlinedVariants('$errorDefault', '$errorLight', '$errorDark', '$errorDisabled'),
|
97
|
+
},
|
98
|
+
{
|
99
|
+
variant: 'primary',
|
100
|
+
outlined: true,
|
101
|
+
css: getOutlinedVariants('$primaryDefault', '$primaryLight', '$primaryDark', '$primaryDisabled'),
|
102
|
+
},
|
103
|
+
],
|
104
|
+
variants: {
|
105
|
+
variant: {
|
106
|
+
standard: getButtonVariants('$secondaryDefault', '$secondaryLight', '$secondaryDark', '$secondaryDisabled'),
|
107
|
+
danger: getButtonVariants('$errorDefault', '$errorLight', '$errorDark', '$errorDisabled'),
|
108
|
+
primary: getButtonVariants('$primaryDefault', '$primaryLight', '$primaryDark', '$primaryDisabled'),
|
109
|
+
},
|
110
|
+
outlined: {
|
111
|
+
true: {},
|
112
|
+
},
|
113
|
+
icon: {
|
114
|
+
true: {},
|
115
|
+
},
|
116
|
+
},
|
117
|
+
defaultVariants: {
|
118
|
+
variant: 'primary',
|
119
|
+
},
|
120
|
+
});
|
121
|
+
|
122
|
+
export const Button = React.forwardRef<
|
123
|
+
HTMLButtonElement,
|
124
|
+
PropsWithChildren<{ loading?: boolean } & ComponentPropsWithRef<typeof StyledButton>>
|
125
|
+
>(({ children, loading = false, icon, ...buttonProps }, ref) => {
|
126
|
+
return (
|
127
|
+
<StyledButton {...buttonProps} ref={ref}>
|
128
|
+
<>
|
129
|
+
{loading && (
|
130
|
+
<Flex align="center" justify="center" css={{ w: '100%', position: 'absolute', left: '0' }}>
|
131
|
+
<Loading color="currentColor" />
|
132
|
+
</Flex>
|
133
|
+
)}
|
134
|
+
<Flex
|
135
|
+
align="center"
|
136
|
+
justify="center"
|
137
|
+
css={{ visibility: loading ? 'hidden' : 'visible', gap: icon ? '$4' : '0' }}
|
138
|
+
>
|
139
|
+
{children}
|
140
|
+
</Flex>
|
141
|
+
</>
|
142
|
+
</StyledButton>
|
143
|
+
);
|
144
|
+
});
|
@@ -0,0 +1 @@
|
|
1
|
+
export { Button } from './Button';
|
@@ -0,0 +1,39 @@
|
|
1
|
+
## Broadcast Message:
|
2
|
+
|
3
|
+
import { Story } from '@storybook/addon-docs';
|
4
|
+
|
5
|
+
This will be received by everyone in the room.
|
6
|
+
|
7
|
+
```js
|
8
|
+
hmsActions.sendBroadcastMessage('hello everyone!'); // yes it's that simple 😉
|
9
|
+
```
|
10
|
+
|
11
|
+
## MVP component
|
12
|
+
|
13
|
+
```jsx
|
14
|
+
const ChatExample = () => {
|
15
|
+
const chats = useHMSStore(selectHMSMessages);
|
16
|
+
const actions = useHMSActions();
|
17
|
+
const [input, setInput] = useState('');
|
18
|
+
const sendMessage = (e: React.FormEvent) => {
|
19
|
+
e.preventDefault();
|
20
|
+
actions.sendBroadcastMessage(input);
|
21
|
+
setInput('');
|
22
|
+
};
|
23
|
+
return (
|
24
|
+
<div>
|
25
|
+
{chats.map(c => (
|
26
|
+
<div>{c.message}</div>
|
27
|
+
))}
|
28
|
+
<form onSubmit={sendMessage}>
|
29
|
+
<input value={input} onChange={e => setInput(e.target.value)} type="text" />
|
30
|
+
<button type="submit">Send</button>
|
31
|
+
</form>
|
32
|
+
</div>
|
33
|
+
);
|
34
|
+
};
|
35
|
+
```
|
36
|
+
|
37
|
+
### Demo
|
38
|
+
|
39
|
+
<Story id="chat-broadcast-message--chat-story-example" />
|
@@ -0,0 +1,39 @@
|
|
1
|
+
import React, { useState } from 'react';
|
2
|
+
import { selectHMSMessages, useHMSActions, useHMSStore } from '@100mslive/react-sdk';
|
3
|
+
import ChatDocs from './Chat.mdx';
|
4
|
+
|
5
|
+
const ChatStories = {
|
6
|
+
title: 'Chat/Broadcast Message',
|
7
|
+
// More on argTypes: https://storybook.js.org/docs/react/api/argtypes
|
8
|
+
parameters: {
|
9
|
+
docs: {
|
10
|
+
page: ChatDocs,
|
11
|
+
},
|
12
|
+
},
|
13
|
+
};
|
14
|
+
|
15
|
+
export default ChatStories;
|
16
|
+
|
17
|
+
const ChatExample = () => {
|
18
|
+
const chats = useHMSStore(selectHMSMessages);
|
19
|
+
const actions = useHMSActions();
|
20
|
+
const [input, setInput] = useState('');
|
21
|
+
const sendMessage = (e: React.FormEvent) => {
|
22
|
+
e.preventDefault();
|
23
|
+
actions.sendBroadcastMessage(input);
|
24
|
+
setInput('');
|
25
|
+
};
|
26
|
+
return (
|
27
|
+
<div>
|
28
|
+
{chats.map(c => (
|
29
|
+
<div>{c.message}</div>
|
30
|
+
))}
|
31
|
+
<form onSubmit={sendMessage}>
|
32
|
+
<input value={input} onChange={e => setInput(e.target.value)} type="text" />
|
33
|
+
<button type="submit">Send</button>
|
34
|
+
</form>
|
35
|
+
</div>
|
36
|
+
);
|
37
|
+
};
|
38
|
+
|
39
|
+
export const ChatStoryExample = ChatExample.bind({});
|
@@ -0,0 +1,61 @@
|
|
1
|
+
import React, { useEffect, useState } from 'react';
|
2
|
+
import { ComponentMeta, ComponentStory } from '@storybook/react';
|
3
|
+
import { CheckIcon } from '@100mslive/react-icons';
|
4
|
+
import { Label } from '../Label';
|
5
|
+
import { Flex } from '../Layout';
|
6
|
+
import { Checkbox } from '.';
|
7
|
+
|
8
|
+
export default {
|
9
|
+
title: 'UI Components/Checkbox',
|
10
|
+
component: CheckboxWithLabelComponent,
|
11
|
+
argTypes: {
|
12
|
+
onCheckedChange: { action: { type: 'clicked' } },
|
13
|
+
checked: { control: { type: 'boolean' } },
|
14
|
+
label: { control: { type: 'text' } },
|
15
|
+
css: { control: { type: 'object' } },
|
16
|
+
},
|
17
|
+
args: {
|
18
|
+
checked: true,
|
19
|
+
label: 'Label',
|
20
|
+
},
|
21
|
+
} as ComponentMeta<typeof CheckboxWithLabelComponent>;
|
22
|
+
|
23
|
+
type CheckboxWithLabelComponentProps = {
|
24
|
+
label?: string;
|
25
|
+
checked?: boolean;
|
26
|
+
} & React.ComponentProps<typeof Checkbox.Root>;
|
27
|
+
|
28
|
+
function CheckboxWithLabelComponent({ label, checked = true, css, onCheckedChange }: CheckboxWithLabelComponentProps) {
|
29
|
+
const [internalChecked, setInternalChecked] = useState(checked);
|
30
|
+
|
31
|
+
useEffect(() => {
|
32
|
+
handleOnCheckedChange(checked);
|
33
|
+
}, [checked]); //eslint-disable-line
|
34
|
+
|
35
|
+
function handleOnCheckedChange(checked: boolean) {
|
36
|
+
setInternalChecked(checked);
|
37
|
+
if (onCheckedChange) {
|
38
|
+
onCheckedChange(checked);
|
39
|
+
}
|
40
|
+
}
|
41
|
+
|
42
|
+
return (
|
43
|
+
<Flex align="center">
|
44
|
+
<Checkbox.Root id={label} checked={internalChecked} css={css} onCheckedChange={handleOnCheckedChange}>
|
45
|
+
<Checkbox.Indicator css={{ display: 'flex' }}>
|
46
|
+
<CheckIcon width={16} height={16} />
|
47
|
+
</Checkbox.Indicator>
|
48
|
+
</Checkbox.Root>
|
49
|
+
<Label htmlFor={label} css={{ ml: '$4', fontSize: '$sm', cursor: 'pointer' }}>
|
50
|
+
{label}
|
51
|
+
</Label>
|
52
|
+
</Flex>
|
53
|
+
);
|
54
|
+
}
|
55
|
+
|
56
|
+
const CheckboxWithLabelStory: ComponentStory<typeof CheckboxWithLabelComponent> = args => {
|
57
|
+
return <CheckboxWithLabelComponent {...args} />;
|
58
|
+
};
|
59
|
+
|
60
|
+
export const Example = CheckboxWithLabelStory.bind({});
|
61
|
+
Example.storyName = 'Checkbox';
|
@@ -0,0 +1,33 @@
|
|
1
|
+
import * as CheckboxPrimitive from '@radix-ui/react-checkbox';
|
2
|
+
import { styled } from '../Theme';
|
3
|
+
|
4
|
+
const CheckboxRoot = styled(CheckboxPrimitive.Root, {
|
5
|
+
all: 'unset',
|
6
|
+
border: '1px solid $brandDefault',
|
7
|
+
backgroundColor: '$white',
|
8
|
+
width: '$8',
|
9
|
+
height: '$8',
|
10
|
+
borderRadius: '$0',
|
11
|
+
display: 'flex',
|
12
|
+
alignItems: 'center',
|
13
|
+
justifyContent: 'center',
|
14
|
+
boxShadow: 'none',
|
15
|
+
outline: 'none',
|
16
|
+
cursor: 'pointer',
|
17
|
+
'&:focus': {
|
18
|
+
boxShadow: 'none',
|
19
|
+
outline: 'none',
|
20
|
+
},
|
21
|
+
'&[data-state="checked"]': {
|
22
|
+
backgroundColor: '$brandDefault',
|
23
|
+
},
|
24
|
+
});
|
25
|
+
|
26
|
+
const CheckboxIndicator = styled(CheckboxPrimitive.Indicator, {
|
27
|
+
color: '$white',
|
28
|
+
});
|
29
|
+
|
30
|
+
export const Checkbox = {
|
31
|
+
Root: CheckboxRoot,
|
32
|
+
Indicator: CheckboxIndicator,
|
33
|
+
};
|