@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,52 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import * as BaseSwitch from '@radix-ui/react-switch';
|
3
|
+
import { styled } from '../Theme';
|
4
|
+
|
5
|
+
const SwitchRoot = styled(BaseSwitch.Root, {
|
6
|
+
all: 'unset',
|
7
|
+
width: '30px',
|
8
|
+
height: '14px',
|
9
|
+
border: 'solid $space$px $secondaryDefault',
|
10
|
+
borderRadius: '$3',
|
11
|
+
p: '$2',
|
12
|
+
position: 'relative',
|
13
|
+
cursor: 'pointer',
|
14
|
+
'&[data-state="checked"]': {
|
15
|
+
backgroundColor: '$primaryDefault',
|
16
|
+
border: 'solid $space$px $primaryDefault',
|
17
|
+
},
|
18
|
+
'&:focus': {
|
19
|
+
outline: 'none',
|
20
|
+
},
|
21
|
+
'&[disabled]': {
|
22
|
+
opacity: 0.5,
|
23
|
+
cursor: 'not-allowed',
|
24
|
+
},
|
25
|
+
});
|
26
|
+
|
27
|
+
const SwitchThumb = styled(BaseSwitch.Thumb, {
|
28
|
+
display: 'block',
|
29
|
+
top: '3px',
|
30
|
+
position: 'absolute',
|
31
|
+
width: '$md',
|
32
|
+
height: '$md',
|
33
|
+
backgroundColor: '$secondaryDefault',
|
34
|
+
borderRadius: '$round',
|
35
|
+
transition: 'right 500ms ease-in',
|
36
|
+
left: '$2',
|
37
|
+
'&[data-state="checked"]': {
|
38
|
+
left: 'unset',
|
39
|
+
right: '$2',
|
40
|
+
backgroundColor: '$textAccentHigh',
|
41
|
+
},
|
42
|
+
});
|
43
|
+
|
44
|
+
type SwitchProps = React.ComponentProps<typeof SwitchRoot>;
|
45
|
+
|
46
|
+
export const Switch: React.FC<SwitchProps> = props => (
|
47
|
+
<SwitchRoot {...props}>
|
48
|
+
<SwitchThumb />
|
49
|
+
</SwitchRoot>
|
50
|
+
);
|
51
|
+
|
52
|
+
Switch.displayName = 'Switch';
|
@@ -0,0 +1 @@
|
|
1
|
+
export { Switch } from './Switch';
|
@@ -0,0 +1,77 @@
|
|
1
|
+
import React, { useCallback, useEffect, useState } from 'react';
|
2
|
+
import { ComponentMeta, ComponentStory } from '@storybook/react';
|
3
|
+
import { Box } from '../Layout';
|
4
|
+
import { Text } from '../Text';
|
5
|
+
import { Tabs } from '.';
|
6
|
+
|
7
|
+
export default {
|
8
|
+
title: 'UI Components/Tabs',
|
9
|
+
component: Tabs.Root,
|
10
|
+
argTypes: {
|
11
|
+
value: { control: { type: 'text' }, defaultValue: 'tab1' },
|
12
|
+
onValueChange: { action: { type: 'click' } },
|
13
|
+
orientation: { options: ['horizontal', 'vertical'], defaultValue: 'horizontal', control: { type: 'select' } },
|
14
|
+
},
|
15
|
+
} as ComponentMeta<typeof Tabs.Root>;
|
16
|
+
|
17
|
+
const Template: ComponentStory<typeof Tabs.Root> = ({
|
18
|
+
value: propValue = '',
|
19
|
+
onValueChange: propOnValueChange,
|
20
|
+
...rest
|
21
|
+
}) => {
|
22
|
+
const [value, setValue] = useState('tab1');
|
23
|
+
|
24
|
+
const handleOnValueChange = useCallback(
|
25
|
+
(value: string) => {
|
26
|
+
setValue(value);
|
27
|
+
if (propOnValueChange) {
|
28
|
+
propOnValueChange(value);
|
29
|
+
}
|
30
|
+
},
|
31
|
+
[propOnValueChange],
|
32
|
+
);
|
33
|
+
|
34
|
+
useEffect(() => {
|
35
|
+
handleOnValueChange(propValue);
|
36
|
+
if (propOnValueChange) {
|
37
|
+
propOnValueChange(value);
|
38
|
+
}
|
39
|
+
}, [handleOnValueChange, propOnValueChange, propValue, value]);
|
40
|
+
|
41
|
+
return (
|
42
|
+
<Tabs.Root
|
43
|
+
css={{
|
44
|
+
gap: '8px',
|
45
|
+
maxWidth: '500px',
|
46
|
+
width: 'max-content',
|
47
|
+
'&[data-orientation="horizontal"]': { flexDirection: 'column' },
|
48
|
+
}}
|
49
|
+
value={value}
|
50
|
+
onValueChange={handleOnValueChange}
|
51
|
+
{...rest}
|
52
|
+
>
|
53
|
+
<Tabs.List
|
54
|
+
aria-label="tabs example"
|
55
|
+
css={{ bg: '$bgSecondary', r: '$1', '&[data-orientation="vertical"]': { flexDirection: 'column' } }}
|
56
|
+
>
|
57
|
+
<Tabs.Trigger value="tab1">One</Tabs.Trigger>
|
58
|
+
<Tabs.Trigger value="tab2">Two</Tabs.Trigger>
|
59
|
+
<Tabs.Trigger value="tab3">Three</Tabs.Trigger>
|
60
|
+
</Tabs.List>
|
61
|
+
<Box css={{ r: '$1', bg: '$bgTertiary' }}>
|
62
|
+
<Tabs.Content value="tab1">
|
63
|
+
<Text>Tab one content</Text>
|
64
|
+
</Tabs.Content>
|
65
|
+
<Tabs.Content value="tab2">
|
66
|
+
<Text>Tab two content</Text>
|
67
|
+
</Tabs.Content>
|
68
|
+
<Tabs.Content value="tab3">
|
69
|
+
<Text>Tab three content</Text>
|
70
|
+
</Tabs.Content>
|
71
|
+
</Box>
|
72
|
+
</Tabs.Root>
|
73
|
+
);
|
74
|
+
};
|
75
|
+
|
76
|
+
export const Example = Template.bind({});
|
77
|
+
Example.storyName = 'Tabs';
|
@@ -0,0 +1,41 @@
|
|
1
|
+
import * as TabsPrimitive from '@radix-ui/react-tabs';
|
2
|
+
import { styled } from '../Theme';
|
3
|
+
|
4
|
+
const StyledTabsRoot = styled(TabsPrimitive.Root, {
|
5
|
+
display: 'flex',
|
6
|
+
});
|
7
|
+
|
8
|
+
const StyledList = styled(TabsPrimitive.List, {
|
9
|
+
flexShrink: 0,
|
10
|
+
display: 'flex',
|
11
|
+
});
|
12
|
+
|
13
|
+
const StyledTrigger = styled(TabsPrimitive.Trigger, {
|
14
|
+
all: 'unset',
|
15
|
+
fontFamily: '$sans',
|
16
|
+
p: '$8',
|
17
|
+
display: 'flex',
|
18
|
+
alignItems: 'center',
|
19
|
+
fontSize: '$sm',
|
20
|
+
lineHeight: '$sm',
|
21
|
+
color: '$textHighEmp',
|
22
|
+
userSelect: 'none',
|
23
|
+
cursor: 'pointer',
|
24
|
+
'&[data-state="active"]': {
|
25
|
+
bg: '$surfaceLighter',
|
26
|
+
r: '$1',
|
27
|
+
},
|
28
|
+
});
|
29
|
+
|
30
|
+
const StyledContent = styled(TabsPrimitive.Content, {
|
31
|
+
flex: '1 1 0',
|
32
|
+
padding: '$10',
|
33
|
+
outline: 'none',
|
34
|
+
});
|
35
|
+
|
36
|
+
export const Tabs = {
|
37
|
+
Root: StyledTabsRoot,
|
38
|
+
List: StyledList,
|
39
|
+
Content: StyledContent,
|
40
|
+
Trigger: StyledTrigger,
|
41
|
+
};
|
@@ -0,0 +1 @@
|
|
1
|
+
export * from './Tabs';
|
@@ -0,0 +1,21 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import { ComponentMeta, ComponentStory } from '@storybook/react';
|
3
|
+
import { Text, textVariants } from './Text';
|
4
|
+
|
5
|
+
export default {
|
6
|
+
title: 'UI Components/Text',
|
7
|
+
component: Text,
|
8
|
+
argTypes: {
|
9
|
+
variant: {
|
10
|
+
control: {
|
11
|
+
type: 'select',
|
12
|
+
options: Object.keys(textVariants),
|
13
|
+
},
|
14
|
+
},
|
15
|
+
},
|
16
|
+
} as ComponentMeta<typeof Text>;
|
17
|
+
|
18
|
+
const Template: ComponentStory<typeof Text> = args => <Text {...args}>The Evil Rabbit jumps.</Text>;
|
19
|
+
|
20
|
+
export const Playground = Template.bind({});
|
21
|
+
Playground.storyName = 'Text';
|
@@ -0,0 +1,149 @@
|
|
1
|
+
import { styled } from '../Theme';
|
2
|
+
|
3
|
+
export const textVariants = {
|
4
|
+
h1: {
|
5
|
+
fontWeight: '$semiBold',
|
6
|
+
letterSpacing: '-1.5px',
|
7
|
+
fontSize: '$h1',
|
8
|
+
lineHeight: '$h1',
|
9
|
+
'@md': {
|
10
|
+
fontSize: '4.5rem',
|
11
|
+
lineHeight: '4.75rem',
|
12
|
+
},
|
13
|
+
},
|
14
|
+
h2: {
|
15
|
+
fontSize: '$h2',
|
16
|
+
lineHeight: '$h2',
|
17
|
+
fontWeight: '$semiBold',
|
18
|
+
letterSpacing: '-0.5px',
|
19
|
+
'@md': {
|
20
|
+
fontSize: '3rem',
|
21
|
+
lineHeight: '3.25rem',
|
22
|
+
},
|
23
|
+
},
|
24
|
+
h3: {
|
25
|
+
fontSize: '$h3',
|
26
|
+
lineHeight: '$h3',
|
27
|
+
fontWeight: '$semiBold',
|
28
|
+
'@md': {
|
29
|
+
fontSize: '2.5rem',
|
30
|
+
lineHeight: '2.75rem',
|
31
|
+
},
|
32
|
+
},
|
33
|
+
h4: {
|
34
|
+
fontSize: '$h4',
|
35
|
+
lineHeight: '$h4',
|
36
|
+
fontWeight: '$semiBold',
|
37
|
+
letterSpacing: '0.25px',
|
38
|
+
'@md': {
|
39
|
+
fontSize: '1.75rem',
|
40
|
+
lineHeight: '2rem',
|
41
|
+
},
|
42
|
+
},
|
43
|
+
h5: {
|
44
|
+
fontSize: '$h5',
|
45
|
+
lineHeight: '$h5',
|
46
|
+
fontWeight: '$semiBold',
|
47
|
+
'@md': {
|
48
|
+
fontSize: '1.5rem',
|
49
|
+
lineHeight: '1.75rem',
|
50
|
+
},
|
51
|
+
},
|
52
|
+
h6: {
|
53
|
+
fontSize: '$h6',
|
54
|
+
lineHeight: '$h6',
|
55
|
+
fontWeight: '$semiBold',
|
56
|
+
letterSpacing: '0.15px',
|
57
|
+
'@md': {
|
58
|
+
fontSize: '1.25rem',
|
59
|
+
lineHeight: '1.5rem',
|
60
|
+
},
|
61
|
+
},
|
62
|
+
sub1: {
|
63
|
+
fontSize: '$md',
|
64
|
+
lineHeight: '$h5',
|
65
|
+
fontWeight: '$medium',
|
66
|
+
letterSpacing: '0.15px',
|
67
|
+
},
|
68
|
+
sub2: {
|
69
|
+
fontSize: '$sm',
|
70
|
+
lineHeight: '$sm',
|
71
|
+
fontWeight: '$medium',
|
72
|
+
letterSpacing: '0.1px',
|
73
|
+
},
|
74
|
+
body1: {
|
75
|
+
fontSize: '$md',
|
76
|
+
lineHeight: '$h6',
|
77
|
+
fontWeight: '$medium',
|
78
|
+
letterSpacing: '0.1px',
|
79
|
+
},
|
80
|
+
body2: {
|
81
|
+
fontSize: '0.875rem',
|
82
|
+
lineHeight: '1.25rem',
|
83
|
+
fontWeight: '$medium',
|
84
|
+
letterSpacing: '0.25px',
|
85
|
+
},
|
86
|
+
button: {
|
87
|
+
fontSize: '1rem',
|
88
|
+
lineHeight: '1.5rem',
|
89
|
+
fontWeight: '$semiBold',
|
90
|
+
letterSpacing: '0.5px',
|
91
|
+
},
|
92
|
+
caption: {
|
93
|
+
fontSize: '0.75rem',
|
94
|
+
lineHeight: '1rem',
|
95
|
+
letterSpacing: '0.4px',
|
96
|
+
fontWeight: '$regular',
|
97
|
+
},
|
98
|
+
overline: {
|
99
|
+
fontSize: '0.625rem',
|
100
|
+
lineHeight: '1rem',
|
101
|
+
letterSpacing: '1.5px',
|
102
|
+
fontWeight: '$medium',
|
103
|
+
},
|
104
|
+
tiny: {
|
105
|
+
fontSize: '$tiny',
|
106
|
+
lineHeight: '$tiny',
|
107
|
+
},
|
108
|
+
xs: {
|
109
|
+
fontSize: '$xs',
|
110
|
+
lineHeight: '$xs',
|
111
|
+
},
|
112
|
+
sm: {
|
113
|
+
fontSize: '$sm',
|
114
|
+
lineHeight: '$sm',
|
115
|
+
},
|
116
|
+
md: {
|
117
|
+
fontSize: '$md',
|
118
|
+
lineHeight: '$md',
|
119
|
+
},
|
120
|
+
lg: {
|
121
|
+
fontSize: '$lg',
|
122
|
+
lineHeight: '$md',
|
123
|
+
fontWeight: '$semiBold',
|
124
|
+
letterSpacing: '0.15px',
|
125
|
+
},
|
126
|
+
};
|
127
|
+
|
128
|
+
export const Text = styled('p', {
|
129
|
+
fontFamily: '$sans',
|
130
|
+
fontWeight: '$regular',
|
131
|
+
margin: 0,
|
132
|
+
color: '$textPrimary',
|
133
|
+
variants: {
|
134
|
+
variant: textVariants,
|
135
|
+
color: {
|
136
|
+
white: {
|
137
|
+
color: '$white',
|
138
|
+
},
|
139
|
+
},
|
140
|
+
inline: {
|
141
|
+
true: {
|
142
|
+
display: 'inline',
|
143
|
+
},
|
144
|
+
},
|
145
|
+
},
|
146
|
+
defaultVariants: {
|
147
|
+
variant: 'md',
|
148
|
+
},
|
149
|
+
});
|
@@ -0,0 +1 @@
|
|
1
|
+
export { Text } from './Text';
|
@@ -0,0 +1,104 @@
|
|
1
|
+
import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
2
|
+
import { useMedia } from 'react-use';
|
3
|
+
import type { Theme } from './stitches.config';
|
4
|
+
import { createTheme, theme } from './stitches.config';
|
5
|
+
import useSSR from './useSSR';
|
6
|
+
|
7
|
+
const defaultAspectRatio = {
|
8
|
+
width: 1,
|
9
|
+
height: 1,
|
10
|
+
};
|
11
|
+
|
12
|
+
export enum ThemeTypes {
|
13
|
+
// eslint-disable-next-line no-unused-vars
|
14
|
+
light = 'light',
|
15
|
+
// eslint-disable-next-line no-unused-vars
|
16
|
+
dark = 'dark',
|
17
|
+
}
|
18
|
+
|
19
|
+
export type ThemeContextValue = {
|
20
|
+
themeType: ThemeTypes;
|
21
|
+
theme: Theme;
|
22
|
+
aspectRatio: { width: number; height: number };
|
23
|
+
/**
|
24
|
+
* @param {ThemeTypes} themeToUpdateTo - optional
|
25
|
+
* Use this to toggle or update the currentTheme.
|
26
|
+
* if a param is passed, it will set the theme to passed value, otherwise will toggle between light and dark
|
27
|
+
* depending on current applied theme
|
28
|
+
*/
|
29
|
+
toggleTheme: (themeToUpdateTo?: ThemeTypes) => void;
|
30
|
+
};
|
31
|
+
|
32
|
+
export type ThemeProviderProps = {
|
33
|
+
themeType?: ThemeTypes;
|
34
|
+
theme?: Theme;
|
35
|
+
aspectRatio?: { width: number; height: number };
|
36
|
+
};
|
37
|
+
|
38
|
+
const defaultContext = {
|
39
|
+
themeType: ThemeTypes.dark,
|
40
|
+
theme,
|
41
|
+
aspectRatio: { width: 1, height: 1 },
|
42
|
+
toggleTheme: (_themeToUpdateTo?: ThemeTypes) => {
|
43
|
+
return;
|
44
|
+
},
|
45
|
+
};
|
46
|
+
export const ThemeContext = React.createContext(defaultContext);
|
47
|
+
|
48
|
+
/**
|
49
|
+
* Wrap this around your root component to get access to theme
|
50
|
+
* eg:
|
51
|
+
* <ThemeProvider type="dark" appBuilder={{ aspectRatio: { width:1, height: 1} }}>
|
52
|
+
* <App />
|
53
|
+
* </ThemeProvider>
|
54
|
+
*/
|
55
|
+
export const HMSThemeProvider: React.FC<React.PropsWithChildren<ThemeProviderProps>> = ({
|
56
|
+
themeType,
|
57
|
+
theme: userTheme,
|
58
|
+
aspectRatio = defaultAspectRatio,
|
59
|
+
children,
|
60
|
+
}) => {
|
61
|
+
const systemTheme = useMedia('prefers-color-scheme: dark') ? ThemeTypes.dark : ThemeTypes.light;
|
62
|
+
const [currentTheme, setCurrentTheme] = useState(themeType || systemTheme);
|
63
|
+
const previousClassName = useRef('');
|
64
|
+
const { isBrowser } = useSSR();
|
65
|
+
const updatedTheme = useMemo(() => {
|
66
|
+
const updatedTheme = createTheme({ themeType: currentTheme, theme: userTheme || {} });
|
67
|
+
if (!isBrowser) {
|
68
|
+
return updatedTheme;
|
69
|
+
}
|
70
|
+
if (previousClassName.current) {
|
71
|
+
document.documentElement.classList.remove(previousClassName.current);
|
72
|
+
}
|
73
|
+
previousClassName.current = updatedTheme.className;
|
74
|
+
document.documentElement.classList.add(updatedTheme);
|
75
|
+
return updatedTheme;
|
76
|
+
}, [userTheme, currentTheme, isBrowser]);
|
77
|
+
|
78
|
+
const toggleTheme = useCallback(
|
79
|
+
(themeToUpdateTo?: ThemeTypes) => {
|
80
|
+
if (themeToUpdateTo) {
|
81
|
+
setCurrentTheme(themeToUpdateTo);
|
82
|
+
return;
|
83
|
+
}
|
84
|
+
setCurrentTheme(currentTheme === ThemeTypes.dark ? ThemeTypes.light : ThemeTypes.dark);
|
85
|
+
},
|
86
|
+
[currentTheme],
|
87
|
+
);
|
88
|
+
|
89
|
+
useEffect(() => {
|
90
|
+
if (themeType) {
|
91
|
+
setCurrentTheme(themeType);
|
92
|
+
}
|
93
|
+
}, [themeType]);
|
94
|
+
|
95
|
+
return (
|
96
|
+
<ThemeContext.Provider
|
97
|
+
value={{ themeType: currentTheme, theme: updatedTheme as unknown as Theme, aspectRatio, toggleTheme }}
|
98
|
+
>
|
99
|
+
{children}
|
100
|
+
</ThemeContext.Provider>
|
101
|
+
);
|
102
|
+
};
|
103
|
+
|
104
|
+
export const useTheme = () => React.useContext(ThemeContext);
|
@@ -0,0 +1,58 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import { ColorItem, ColorPalette } from '@storybook/addon-docs';
|
3
|
+
|
4
|
+
const ThemeStory = () => {
|
5
|
+
return (
|
6
|
+
<ColorPalette>
|
7
|
+
<ColorItem
|
8
|
+
title="theme.color.brand"
|
9
|
+
subtitle="Brand Variants"
|
10
|
+
colors={{ brandLight: '#74AAFF', brandDefault: '#2F80FF', brandDark: '#0B326F', brandDisabled: '#D8E7FF' }}
|
11
|
+
/>
|
12
|
+
<ColorItem
|
13
|
+
title="theme.color.text"
|
14
|
+
subtitle="Text Variants"
|
15
|
+
colors={{
|
16
|
+
textHighEmp: 'rgba(250, 252, 255, 0.9)',
|
17
|
+
textMedEmp: 'rgba(215, 227, 245, 0.8)',
|
18
|
+
textDisabled: 'rgba(164, 176, 193, 0.5)',
|
19
|
+
textMedWhite: 'rgba(255, 255, 255, 0.72)',
|
20
|
+
textDarkWhite: 'rgba(255, 255, 255, 0.48)',
|
21
|
+
}}
|
22
|
+
/>
|
23
|
+
<ColorItem
|
24
|
+
title="theme.color.surface"
|
25
|
+
subtitle="Surface Variants"
|
26
|
+
colors={{
|
27
|
+
surfaceDarker: '#06080A',
|
28
|
+
surfaceDark: '#080B0F',
|
29
|
+
surfaceDefault: '#0B0F15',
|
30
|
+
surfaceLight: '#12161C',
|
31
|
+
surfaceLighter: '#1F2228',
|
32
|
+
}}
|
33
|
+
/>
|
34
|
+
<ColorItem
|
35
|
+
title="theme.color.primary"
|
36
|
+
subtitle="Primary Variants"
|
37
|
+
colors={{
|
38
|
+
primaryLight: '#6DA6FF',
|
39
|
+
primaryDefault: '#2F80FF',
|
40
|
+
primaryDark: '#184080',
|
41
|
+
primaryDisabled: '#D8E7FF',
|
42
|
+
}}
|
43
|
+
/>
|
44
|
+
<ColorItem
|
45
|
+
title="theme.color.secondary"
|
46
|
+
subtitle="Secondary Variants"
|
47
|
+
colors={{
|
48
|
+
secondaryLight: '#505863',
|
49
|
+
secondaryDefault: '#657080',
|
50
|
+
secondaryDark: '#1E2329',
|
51
|
+
secondaryDisabled: '#DCE4EF',
|
52
|
+
}}
|
53
|
+
/>
|
54
|
+
</ColorPalette>
|
55
|
+
);
|
56
|
+
};
|
57
|
+
|
58
|
+
export default ThemeStory;
|