@trtc/calls-uikit-react 4.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README-zh_CN.md +97 -0
- package/README.md +104 -0
- package/debug/GenerateTestUserSig-es.js +26 -0
- package/debug/lib-generate-test-usersig-es.min.js +2 -0
- package/package.json +42 -0
- package/src/Components/TUICallKit/TUICallKit.module.scss +21 -0
- package/src/Components/TUICallKit/TUICallKit.tsx +267 -0
- package/src/Components/TUICallKit/index.ts +3 -0
- package/src/Components/assets/base/close.svg +1 -0
- package/src/Components/assets/base/error.svg +1 -0
- package/src/Components/assets/base/info.svg +1 -0
- package/src/Components/assets/base/loading-circle.svg +1 -0
- package/src/Components/assets/base/success.svg +1 -0
- package/src/Components/assets/base/waring.svg +1 -0
- package/src/Components/assets/button/accept.svg +10 -0
- package/src/Components/assets/button/backgroundBlurClose.svg +3 -0
- package/src/Components/assets/button/backgroundBlurOpen.svg +3 -0
- package/src/Components/assets/button/camera-close.svg +8 -0
- package/src/Components/assets/button/camera-open.svg +3 -0
- package/src/Components/assets/button/desktop/arrow.png +0 -0
- package/src/Components/assets/button/desktop/fullScreen.svg +4 -0
- package/src/Components/assets/button/desktop/minimize.svg +6 -0
- package/src/Components/assets/button/hangup.svg +3 -0
- package/src/Components/assets/button/microphone-close.svg +4 -0
- package/src/Components/assets/button/microphone-open.svg +4 -0
- package/src/Components/assets/button/mobile/down.svg +4 -0
- package/src/Components/assets/button/mobile/minimize.svg +4 -0
- package/src/Components/assets/button/mobile/switch-camera.svg +3 -0
- package/src/Components/assets/button/mobile/up.svg +4 -0
- package/src/Components/assets/button/speaker-close.svg +4 -0
- package/src/Components/assets/button/speaker-open.svg +3 -0
- package/src/Components/assets/button/switch-audio.svg +3 -0
- package/src/Components/assets/callMessage/audioCall.svg +3 -0
- package/src/Components/assets/callMessage/videoCall.svg +3 -0
- package/src/Components/assets/common/defaultAvatar.svg +11 -0
- package/src/Components/assets/common/microphone-volumn-close.svg +9 -0
- package/src/Components/assets/floatingWindow/desktop/floatCallEnd.svg +3 -0
- package/src/Components/assets/floatingWindow/desktop/floatFullScreen.svg +3 -0
- package/src/Components/assets/floatingWindow/desktop/floatMicrophone.svg +4 -0
- package/src/Components/assets/floatingWindow/desktop/floatMicrophoneClosed.svg +3 -0
- package/src/Components/assets/floatingWindow/mobile/camera-close.svg +14 -0
- package/src/Components/assets/floatingWindow/mobile/camera-open.svg +14 -0
- package/src/Components/assets/floatingWindow/mobile/earphone.svg +3 -0
- package/src/Components/assets/floatingWindow/mobile/microphone-close.svg +4 -0
- package/src/Components/assets/floatingWindow/mobile/microphone-open.svg +4 -0
- package/src/Components/assets/permission/desktop/index.ts +11 -0
- package/src/Components/assets/permission/desktop/mac/permit-en.jpg +0 -0
- package/src/Components/assets/permission/desktop/mac/permit-zh.jpg +0 -0
- package/src/Components/assets/permission/desktop/win/permit-en.png +0 -0
- package/src/Components/assets/permission/desktop/win/permit-zh.png +0 -0
- package/src/Components/assets/streamInfo/mobile/microphone-close-group.svg +19 -0
- package/src/Components/assets/streamInfo/mobile/microphone-close-single.svg +6 -0
- package/src/Components/assets/streamInfo/mobile/volumn.svg +20 -0
- package/src/Components/assets/streamInfo/networkStatus.svg +22 -0
- package/src/Components/components/GroupCall/GroupCall.module.scss +13 -0
- package/src/Components/components/GroupCall/GroupCall.tsx +82 -0
- package/src/Components/components/GroupCall/MediaContainer/AudioStream/AudioStream.tsx +41 -0
- package/src/Components/components/GroupCall/MediaContainer/MediaContainer.module.scss +74 -0
- package/src/Components/components/GroupCall/MediaContainer/MediaContainer.tsx +138 -0
- package/src/Components/components/GroupCall/MediaContainer/StreamLoading/StreamLoading.tsx +48 -0
- package/src/Components/components/GroupCall/MediaContainer/index.ts +3 -0
- package/src/Components/components/GroupCall/Waiting/Waiting.module.scss +44 -0
- package/src/Components/components/GroupCall/Waiting/Waiting.tsx +89 -0
- package/src/Components/components/SingleCall/MediaContainer/AudioStream/AudioStream.tsx +86 -0
- package/src/Components/components/SingleCall/MediaContainer/MediaContainer.module.scss +33 -0
- package/src/Components/components/SingleCall/MediaContainer/MediaContainer.tsx +121 -0
- package/src/Components/components/SingleCall/MediaContainer/hooks/useGetLargeViewName.ts +29 -0
- package/src/Components/components/SingleCall/MediaContainer/index.ts +3 -0
- package/src/Components/components/SingleCall/SingleCall.module.scss +28 -0
- package/src/Components/components/SingleCall/SingleCall.tsx +54 -0
- package/src/Components/components/SingleCall/Waiting/Waiting.module.scss +3 -0
- package/src/Components/components/SingleCall/Waiting/Waiting.tsx +45 -0
- package/src/Components/components/base/Avatar/Avatar.scss +28 -0
- package/src/Components/components/base/Avatar/Avatar.tsx +52 -0
- package/src/Components/components/base/Avatar/index.ts +3 -0
- package/src/Components/components/base/Button/Button.scss +122 -0
- package/src/Components/components/base/Button/Button.tsx +107 -0
- package/src/Components/components/base/Button/index.ts +3 -0
- package/src/Components/components/base/Drag/Drag.tsx +155 -0
- package/src/Components/components/base/Drag/index.tsx +3 -0
- package/src/Components/components/base/Grid/Col/Col.scss +31 -0
- package/src/Components/components/base/Grid/Col/Col.tsx +52 -0
- package/src/Components/components/base/Grid/Col/index.ts +3 -0
- package/src/Components/components/base/Grid/Row/Row.scss +27 -0
- package/src/Components/components/base/Grid/Row/Row.tsx +51 -0
- package/src/Components/components/base/Grid/Row/index.ts +5 -0
- package/src/Components/components/base/Grid/style/mixin.scss +61 -0
- package/src/Components/components/base/GridLayout/GridLayout.tsx +189 -0
- package/src/Components/components/base/GridLayout/GridPlusItem/GridPlusItem.scss +11 -0
- package/src/Components/components/base/GridLayout/GridPlusItem/GridPlusItem.tsx +37 -0
- package/src/Components/components/base/GridLayout/index.ts +7 -0
- package/src/Components/components/base/Icon/Icon.tsx +25 -0
- package/src/Components/components/base/Loading/Circle/Cilrcle.tsx +20 -0
- package/src/Components/components/base/Loading/Circle/Circle.scss +29 -0
- package/src/Components/components/base/Loading/Dot/Dot.scss +69 -0
- package/src/Components/components/base/Loading/Dot/Dot.tsx +21 -0
- package/src/Components/components/base/Loading/Loading.scss +22 -0
- package/src/Components/components/base/Loading/Loading.tsx +47 -0
- package/src/Components/components/base/Loading/index.ts +3 -0
- package/src/Components/components/base/Message/Message.scss +61 -0
- package/src/Components/components/base/Message/Message.tsx +94 -0
- package/src/Components/components/base/Message/MessageIcon/Error.tsx +7 -0
- package/src/Components/components/base/Message/MessageIcon/Info.tsx +7 -0
- package/src/Components/components/base/Message/MessageIcon/Success.tsx +8 -0
- package/src/Components/components/base/Message/MessageIcon/Warning.tsx +7 -0
- package/src/Components/components/base/Message/MessagePlugin.tsx +148 -0
- package/src/Components/components/base/Overlayer/Overlayer.scss +17 -0
- package/src/Components/components/base/Overlayer/Overlayer.tsx +49 -0
- package/src/Components/components/base/Popup/Popup.scss +34 -0
- package/src/Components/components/base/Popup/Popup.tsx +91 -0
- package/src/Components/components/base/Popup/hooks/useTrigger.tsx +67 -0
- package/src/Components/components/base/Portal/Portal.tsx +74 -0
- package/src/Components/components/base/Text/Text.scss +15 -0
- package/src/Components/components/base/Text/Text.tsx +30 -0
- package/src/Components/components/base/Time/Time.scss +14 -0
- package/src/Components/components/base/Time/Time.tsx +13 -0
- package/src/Components/components/base/ToggleWindow/ToggleWindow.scss +9 -0
- package/src/Components/components/base/ToggleWindow/ToggleWindow.tsx +83 -0
- package/src/Components/components/base/ToggleWindow/ToggleWindowItem/ToggleWindowItem.scss +51 -0
- package/src/Components/components/base/ToggleWindow/ToggleWindowItem/ToggleWindowItem.tsx +50 -0
- package/src/Components/components/base/ToggleWindow/index.ts +7 -0
- package/src/Components/components/base/common.ts +13 -0
- package/src/Components/components/base/hooks/useControlled.ts +31 -0
- package/src/Components/components/base/hooks/useDrag.ts +96 -0
- package/src/Components/components/base/hooks/useListenerEvent.ts +37 -0
- package/src/Components/components/base/hooks/useMutationObserver.ts +38 -0
- package/src/Components/components/base/hooks/useOnClickOutSide.ts +24 -0
- package/src/Components/components/base/util/index.ts +26 -0
- package/src/Components/components/common/ButtonPanel/ButtonPanel.tsx +127 -0
- package/src/Components/components/common/ButtonPanel/ButtonPanelH5/ButtonPanelH5.module.scss +67 -0
- package/src/Components/components/common/ButtonPanel/ButtonPanelH5/ButtonPanelH5.tsx +153 -0
- package/src/Components/components/common/ButtonPanel/ButtonPanelPC/ButtonPanelPC.module.scss +9 -0
- package/src/Components/components/common/ButtonPanel/ButtonPanelPC/ButtonPanelPC.tsx +32 -0
- package/src/Components/components/common/ButtonPanel/button/Accept/Accept.module.scss +7 -0
- package/src/Components/components/common/ButtonPanel/button/Accept/Accept.tsx +39 -0
- package/src/Components/components/common/ButtonPanel/button/Accept/index.ts +3 -0
- package/src/Components/components/common/ButtonPanel/button/BackgroundBlur/BackgroundBlur.module.scss +15 -0
- package/src/Components/components/common/ButtonPanel/button/BackgroundBlur/BackgroundBlur.tsx +46 -0
- package/src/Components/components/common/ButtonPanel/button/BackgroundBlur/index.ts +3 -0
- package/src/Components/components/common/ButtonPanel/button/Camera.tsx +81 -0
- package/src/Components/components/common/ButtonPanel/button/FullScreen/FullScreen.module.scss +13 -0
- package/src/Components/components/common/ButtonPanel/button/FullScreen/FullScreen.tsx +26 -0
- package/src/Components/components/common/ButtonPanel/button/FullScreen/index.ts +3 -0
- package/src/Components/components/common/ButtonPanel/button/Hangup/Hangup.module.scss +7 -0
- package/src/Components/components/common/ButtonPanel/button/Hangup/Hangup.tsx +42 -0
- package/src/Components/components/common/ButtonPanel/button/Hangup/index.ts +3 -0
- package/src/Components/components/common/ButtonPanel/button/Microphone.tsx +78 -0
- package/src/Components/components/common/ButtonPanel/button/Minimize/Minimize.module.scss +23 -0
- package/src/Components/components/common/ButtonPanel/button/Minimize/Minimize.tsx +35 -0
- package/src/Components/components/common/ButtonPanel/button/Minimize/index.ts +3 -0
- package/src/Components/components/common/ButtonPanel/button/Reject/Reject.module.scss +7 -0
- package/src/Components/components/common/ButtonPanel/button/Reject/Reject.tsx +39 -0
- package/src/Components/components/common/ButtonPanel/button/Reject/index.ts +3 -0
- package/src/Components/components/common/ButtonPanel/button/Speaker.tsx +75 -0
- package/src/Components/components/common/ButtonPanel/button/SwitchAudioCall.tsx +32 -0
- package/src/Components/components/common/ButtonPanel/button/SwitchCamera.tsx +19 -0
- package/src/Components/components/common/ButtonPanel/button/common.module.scss +51 -0
- package/src/Components/components/common/ButtonPanel/config.ts +505 -0
- package/src/Components/components/common/ButtonPanel/index.ts +3 -0
- package/src/Components/components/common/CallMessage/CallMessage.tsx +18 -0
- package/src/Components/components/common/CallMessage/CallMessageC2C/CallMessageC2C.module.scss +19 -0
- package/src/Components/components/common/CallMessage/CallMessageC2C/CallMessageC2C.tsx +84 -0
- package/src/Components/components/common/CallMessage/CallMessageGroup/CallMessageGroup.module.scss +5 -0
- package/src/Components/components/common/CallMessage/CallMessageGroup/CallMessageGroup.tsx +37 -0
- package/src/Components/components/common/CallMessage/index.ts +3 -0
- package/src/Components/components/common/DeviceSelector/DeviceSelector.module.scss +62 -0
- package/src/Components/components/common/DeviceSelector/DeviceSelector.tsx +105 -0
- package/src/Components/components/common/FloatingWindow/FloatingWindow.tsx +37 -0
- package/src/Components/components/common/FloatingWindow/FloatingWindowGroupCall/FloatingWindowGroupCall.tsx +97 -0
- package/src/Components/components/common/FloatingWindow/FloatingWindowGroupCall/style/FloatingWindowGroupCall.module.scss +2 -0
- package/src/Components/components/common/FloatingWindow/FloatingWindowGroupCall/style/mobile.module.scss +126 -0
- package/src/Components/components/common/FloatingWindow/FloatingWindowGroupCall/style/pc.module.scss +126 -0
- package/src/Components/components/common/FloatingWindow/FloatingWindowSingleCall/FloatingWindowSingleCall.tsx +75 -0
- package/src/Components/components/common/FloatingWindow/FloatingWindowSingleCall/style/FloatingWindowSingleCall.module.scss +2 -0
- package/src/Components/components/common/FloatingWindow/FloatingWindowSingleCall/style/mobile.module.scss +117 -0
- package/src/Components/components/common/FloatingWindow/FloatingWindowSingleCall/style/pc.module.scss +123 -0
- package/src/Components/components/common/FloatingWindow/index.ts +3 -0
- package/src/Components/components/common/MicrophoneVolumn/MicrophoneVolumn.module.scss +9 -0
- package/src/Components/components/common/MicrophoneVolumn/MicrophoneVolumn.tsx +50 -0
- package/src/Components/components/common/OverlayStream/OverlayStream.module.scss +165 -0
- package/src/Components/components/common/OverlayStream/OverlayStream.tsx +119 -0
- package/src/Components/components/common/Player/Player.module.scss +11 -0
- package/src/Components/components/common/Player/Player.tsx +75 -0
- package/src/Components/components/common/Pusher/Pusher.module.scss +10 -0
- package/src/Components/components/common/Pusher/Pusher.tsx +96 -0
- package/src/Components/components/common/StreamInfo/StreamInfo.tsx +10 -0
- package/src/Components/components/common/StreamInfo/StreamInfoH5/StreamInfoH5.module.scss +21 -0
- package/src/Components/components/common/StreamInfo/StreamInfoH5/StreamInfoH5.tsx +95 -0
- package/src/Components/components/common/StreamInfo/StreamInfoPC/StreamInfoPC.module.scss +38 -0
- package/src/Components/components/common/StreamInfo/StreamInfoPC/StreamInfoPC.tsx +35 -0
- package/src/Components/components/common/StreamInfo/index.ts +3 -0
- package/src/Components/components/common/Tip/Tip.tsx +68 -0
- package/src/Components/components/common/TopBar/TopBar.tsx +17 -0
- package/src/Components/components/common/TopBar/h5/TopBarH5.module.scss +12 -0
- package/src/Components/components/common/TopBar/h5/TopBarH5.tsx +40 -0
- package/src/Components/components/common/TopBar/pc/TopBarPC.module.scss +8 -0
- package/src/Components/components/common/TopBar/pc/TopBarPC.tsx +36 -0
- package/src/Components/const/common.ts +15 -0
- package/src/Components/context/CallUserInfoContext.ts +21 -0
- package/src/Components/context/CallerUserInfoContext.ts +11 -0
- package/src/Components/context/CustomUIConfigContext.ts +6 -0
- package/src/Components/context/FocusItemContext.ts +13 -0
- package/src/Components/context/IsClickableContext.ts +5 -0
- package/src/Components/context/TranslateContext.ts +6 -0
- package/src/Components/context/UserInfoContext.ts +9 -0
- package/src/Components/context/index.ts +17 -0
- package/src/Components/hooks/index.ts +9 -0
- package/src/Components/hooks/useCallDuration.ts +34 -0
- package/src/Components/hooks/useCustomButtonUIConfig.ts +27 -0
- package/src/Components/hooks/useDeviceList.ts +53 -0
- package/src/Components/hooks/useGetSpeakers.ts +69 -0
- package/src/Components/hooks/useGetVolumeMap.ts +67 -0
- package/src/Components/hooks/useNetWorkStatus.ts +34 -0
- package/src/Components/hooks/useTranslate.ts +7 -0
- package/src/Components/hooks/useViewBackgroundConfig.ts +8 -0
- package/src/Components/style/common/mixin.scss +22 -0
- package/src/Components/style/common/var.scss +21 -0
- package/src/Components/style/index.scss +5 -0
- package/src/Components/style/theme/_dark.scss +56 -0
- package/src/Components/style/theme/_light.scss +56 -0
- package/src/Components/style/theme/_util.scss +79 -0
- package/src/Components/style/theme/color.scss +23 -0
- package/src/Components/util/classnames.ts +35 -0
- package/src/Components/util/index.ts +138 -0
- package/src/Components/util/uiDesign.ts +45 -0
- package/src/TUICallService/CallService/UIDesign.ts +174 -0
- package/src/TUICallService/CallService/bellContext.ts +88 -0
- package/src/TUICallService/CallService/chatCombine.ts +313 -0
- package/src/TUICallService/CallService/engineEventHandler.ts +404 -0
- package/src/TUICallService/CallService/index.ts +797 -0
- package/src/TUICallService/CallService/miniProgram.ts +65 -0
- package/src/TUICallService/CallService/utils.ts +281 -0
- package/src/TUICallService/TUIGlobal/tuiGlobal.ts +43 -0
- package/src/TUICallService/TUIStore/callStore.ts +93 -0
- package/src/TUICallService/TUIStore/tuiStore.ts +167 -0
- package/src/TUICallService/assets/phone_dialing.mp3 +0 -0
- package/src/TUICallService/assets/phone_ringing.mp3 +0 -0
- package/src/TUICallService/const/call.ts +157 -0
- package/src/TUICallService/const/error.ts +20 -0
- package/src/TUICallService/const/index.ts +103 -0
- package/src/TUICallService/const/log.ts +9 -0
- package/src/TUICallService/index.ts +37 -0
- package/src/TUICallService/interface/ICallService.ts +70 -0
- package/src/TUICallService/interface/ICallStore.ts +55 -0
- package/src/TUICallService/interface/ITUIGlobal.ts +36 -0
- package/src/TUICallService/interface/ITUIStore.ts +87 -0
- package/src/TUICallService/interface/index.ts +4 -0
- package/src/TUICallService/locales/en.ts +135 -0
- package/src/TUICallService/locales/index.ts +61 -0
- package/src/TUICallService/locales/ja_JP.ts +134 -0
- package/src/TUICallService/locales/zh-cn.ts +130 -0
- package/src/TUICallService/serve/callManager.ts +109 -0
- package/src/TUICallService/utils/common-utils.ts +269 -0
- package/src/TUICallService/utils/decorators/promise-retry.ts +51 -0
- package/src/TUICallService/utils/env.ts +51 -0
- package/src/TUICallService/utils/index.ts +32 -0
- package/src/TUICallService/utils/is-empty.ts +31 -0
- package/src/TUICallService/utils/retry.ts +88 -0
- package/src/TUICallService/utils/timer.ts +162 -0
- package/src/TUICallService/utils/validate/avoidRepeatedCall.ts +39 -0
- package/src/TUICallService/utils/validate/index.ts +7 -0
- package/src/TUICallService/utils/validate/validateConfig.ts +188 -0
- package/src/TUICallService/utils/validate/validateParams.ts +88 -0
- package/src/TUICallService/utils/validate/validateStatus.ts +26 -0
- package/src/image.d.ts +8 -0
- package/src/index.ts +63 -0
- package/src/style.d.ts +1 -0
- package/tuicall-uikit-react.es.js +13177 -0
- package/tuicall-uikit-react.umd.js +133 -0
- package/types/Components/TUICallKit/TUICallKit.d.ts +15 -0
- package/types/Components/TUICallKit/index.d.ts +2 -0
- package/types/Components/assets/permission/desktop/index.d.ts +5 -0
- package/types/Components/components/GroupCall/GroupCall.d.ts +1 -0
- package/types/Components/components/GroupCall/MediaContainer/AudioStream/AudioStream.d.ts +10 -0
- package/types/Components/components/GroupCall/MediaContainer/MediaContainer.d.ts +1 -0
- package/types/Components/components/GroupCall/MediaContainer/StreamLoading/StreamLoading.d.ts +7 -0
- package/types/Components/components/GroupCall/MediaContainer/index.d.ts +2 -0
- package/types/Components/components/GroupCall/Waiting/Waiting.d.ts +8 -0
- package/types/Components/components/SingleCall/MediaContainer/AudioStream/AudioStream.d.ts +11 -0
- package/types/Components/components/SingleCall/MediaContainer/MediaContainer.d.ts +1 -0
- package/types/Components/components/SingleCall/MediaContainer/hooks/useGetLargeViewName.d.ts +3 -0
- package/types/Components/components/SingleCall/MediaContainer/index.d.ts +2 -0
- package/types/Components/components/SingleCall/SingleCall.d.ts +3 -0
- package/types/Components/components/SingleCall/Waiting/Waiting.d.ts +9 -0
- package/types/Components/components/base/Avatar/Avatar.d.ts +12 -0
- package/types/Components/components/base/Avatar/index.d.ts +2 -0
- package/types/Components/components/base/Button/Button.d.ts +25 -0
- package/types/Components/components/base/Button/index.d.ts +2 -0
- package/types/Components/components/base/Drag/Drag.d.ts +14 -0
- package/types/Components/components/base/Drag/index.d.ts +2 -0
- package/types/Components/components/base/Grid/Col/Col.d.ts +14 -0
- package/types/Components/components/base/Grid/Col/index.d.ts +2 -0
- package/types/Components/components/base/Grid/Row/Row.d.ts +14 -0
- package/types/Components/components/base/Grid/Row/index.d.ts +3 -0
- package/types/Components/components/base/GridLayout/GridLayout.d.ts +11 -0
- package/types/Components/components/base/GridLayout/GridPlusItem/GridPlusItem.d.ts +14 -0
- package/types/Components/components/base/GridLayout/index.d.ts +3 -0
- package/types/Components/components/base/Icon/Icon.d.ts +9 -0
- package/types/Components/components/base/Loading/Circle/Cilrcle.d.ts +6 -0
- package/types/Components/components/base/Loading/Dot/Dot.d.ts +6 -0
- package/types/Components/components/base/Loading/Loading.d.ts +14 -0
- package/types/Components/components/base/Loading/index.d.ts +2 -0
- package/types/Components/components/base/Message/Message.d.ts +16 -0
- package/types/Components/components/base/Message/MessageIcon/Error.d.ts +1 -0
- package/types/Components/components/base/Message/MessageIcon/Info.d.ts +1 -0
- package/types/Components/components/base/Message/MessageIcon/Success.d.ts +1 -0
- package/types/Components/components/base/Message/MessageIcon/Warning.d.ts +1 -0
- package/types/Components/components/base/Message/MessagePlugin.d.ts +14 -0
- package/types/Components/components/base/Overlayer/Overlayer.d.ts +14 -0
- package/types/Components/components/base/Popup/Popup.d.ts +13 -0
- package/types/Components/components/base/Popup/hooks/useTrigger.d.ts +10 -0
- package/types/Components/components/base/Portal/Portal.d.ts +19 -0
- package/types/Components/components/base/Text/Text.d.ts +10 -0
- package/types/Components/components/base/Time/Time.d.ts +7 -0
- package/types/Components/components/base/ToggleWindow/ToggleWindow.d.ts +15 -0
- package/types/Components/components/base/ToggleWindow/ToggleWindowItem/ToggleWindowItem.d.ts +14 -0
- package/types/Components/components/base/ToggleWindow/index.d.ts +3 -0
- package/types/Components/components/base/common.d.ts +7 -0
- package/types/Components/components/base/hooks/useControlled.d.ts +8 -0
- package/types/Components/components/base/hooks/useDrag.d.ts +6 -0
- package/types/Components/components/base/hooks/useListenerEvent.d.ts +13 -0
- package/types/Components/components/base/hooks/useMutationObserver.d.ts +4 -0
- package/types/Components/components/base/hooks/useOnClickOutSide.d.ts +1 -0
- package/types/Components/components/base/util/index.d.ts +5 -0
- package/types/Components/components/common/ButtonPanel/ButtonPanel.d.ts +1 -0
- package/types/Components/components/common/ButtonPanel/ButtonPanelH5/ButtonPanelH5.d.ts +8 -0
- package/types/Components/components/common/ButtonPanel/ButtonPanelPC/ButtonPanelPC.d.ts +6 -0
- package/types/Components/components/common/ButtonPanel/button/Accept/Accept.d.ts +5 -0
- package/types/Components/components/common/ButtonPanel/button/Accept/index.d.ts +2 -0
- package/types/Components/components/common/ButtonPanel/button/BackgroundBlur/BackgroundBlur.d.ts +1 -0
- package/types/Components/components/common/ButtonPanel/button/BackgroundBlur/index.d.ts +2 -0
- package/types/Components/components/common/ButtonPanel/button/Camera.d.ts +5 -0
- package/types/Components/components/common/ButtonPanel/button/FullScreen/FullScreen.d.ts +5 -0
- package/types/Components/components/common/ButtonPanel/button/FullScreen/index.d.ts +2 -0
- package/types/Components/components/common/ButtonPanel/button/Hangup/Hangup.d.ts +5 -0
- package/types/Components/components/common/ButtonPanel/button/Hangup/index.d.ts +2 -0
- package/types/Components/components/common/ButtonPanel/button/Microphone.d.ts +5 -0
- package/types/Components/components/common/ButtonPanel/button/Minimize/Minimize.d.ts +1 -0
- package/types/Components/components/common/ButtonPanel/button/Minimize/index.d.ts +2 -0
- package/types/Components/components/common/ButtonPanel/button/Reject/Reject.d.ts +5 -0
- package/types/Components/components/common/ButtonPanel/button/Reject/index.d.ts +2 -0
- package/types/Components/components/common/ButtonPanel/button/Speaker.d.ts +5 -0
- package/types/Components/components/common/ButtonPanel/button/SwitchAudioCall.d.ts +1 -0
- package/types/Components/components/common/ButtonPanel/button/SwitchCamera.d.ts +1 -0
- package/types/Components/components/common/ButtonPanel/config.d.ts +254 -0
- package/types/Components/components/common/ButtonPanel/index.d.ts +2 -0
- package/types/Components/components/common/CallMessage/CallMessage.d.ts +10 -0
- package/types/Components/components/common/CallMessage/CallMessageC2C/CallMessageC2C.d.ts +2 -0
- package/types/Components/components/common/CallMessage/CallMessageGroup/CallMessageGroup.d.ts +2 -0
- package/types/Components/components/common/CallMessage/index.d.ts +2 -0
- package/types/Components/components/common/DeviceSelector/DeviceSelector.d.ts +7 -0
- package/types/Components/components/common/FloatingWindow/FloatingWindow.d.ts +10 -0
- package/types/Components/components/common/FloatingWindow/FloatingWindowGroupCall/FloatingWindowGroupCall.d.ts +9 -0
- package/types/Components/components/common/FloatingWindow/FloatingWindowSingleCall/FloatingWindowSingleCall.d.ts +10 -0
- package/types/Components/components/common/FloatingWindow/index.d.ts +2 -0
- package/types/Components/components/common/MicrophoneVolumn/MicrophoneVolumn.d.ts +8 -0
- package/types/Components/components/common/OverlayStream/OverlayStream.d.ts +28 -0
- package/types/Components/components/common/Player/Player.d.ts +15 -0
- package/types/Components/components/common/Pusher/Pusher.d.ts +13 -0
- package/types/Components/components/common/StreamInfo/StreamInfo.d.ts +1 -0
- package/types/Components/components/common/StreamInfo/StreamInfoH5/StreamInfoH5.d.ts +10 -0
- package/types/Components/components/common/StreamInfo/StreamInfoPC/StreamInfoPC.d.ts +9 -0
- package/types/Components/components/common/StreamInfo/index.d.ts +2 -0
- package/types/Components/components/common/Tip/Tip.d.ts +7 -0
- package/types/Components/components/common/TopBar/TopBar.d.ts +1 -0
- package/types/Components/components/common/TopBar/h5/TopBarH5.d.ts +5 -0
- package/types/Components/components/common/TopBar/pc/TopBarPC.d.ts +5 -0
- package/types/Components/const/common.d.ts +11 -0
- package/types/Components/context/CallUserInfoContext.d.ts +17 -0
- package/types/Components/context/CallerUserInfoContext.d.ts +7 -0
- package/types/Components/context/CustomUIConfigContext.d.ts +3 -0
- package/types/Components/context/FocusItemContext.d.ts +8 -0
- package/types/Components/context/IsClickableContext.d.ts +2 -0
- package/types/Components/context/TranslateContext.d.ts +4 -0
- package/types/Components/context/UserInfoContext.d.ts +6 -0
- package/types/Components/context/index.d.ts +8 -0
- package/types/Components/hooks/index.d.ts +4 -0
- package/types/Components/hooks/useCallDuration.d.ts +1 -0
- package/types/Components/hooks/useCustomButtonUIConfig.d.ts +1 -0
- package/types/Components/hooks/useDeviceList.d.ts +8 -0
- package/types/Components/hooks/useGetSpeakers.d.ts +1 -0
- package/types/Components/hooks/useGetVolumeMap.d.ts +3 -0
- package/types/Components/hooks/useNetWorkStatus.d.ts +1 -0
- package/types/Components/hooks/useTranslate.d.ts +3 -0
- package/types/Components/hooks/useViewBackgroundConfig.d.ts +1 -0
- package/types/Components/util/classnames.d.ts +1 -0
- package/types/Components/util/index.d.ts +15 -0
- package/types/Components/util/uiDesign.d.ts +2 -0
- package/types/TUICallService/CallService/UIDesign.d.ts +28 -0
- package/types/TUICallService/CallService/bellContext.d.ts +19 -0
- package/types/TUICallService/CallService/chatCombine.d.ts +50 -0
- package/types/TUICallService/CallService/engineEventHandler.d.ts +35 -0
- package/types/TUICallService/CallService/index.d.ts +98 -0
- package/types/TUICallService/CallService/miniProgram.d.ts +7 -0
- package/types/TUICallService/CallService/utils.d.ts +42 -0
- package/types/TUICallService/TUIGlobal/tuiGlobal.d.ts +21 -0
- package/types/TUICallService/TUIStore/callStore.d.ts +10 -0
- package/types/TUICallService/TUIStore/tuiStore.d.ts +57 -0
- package/types/TUICallService/const/call.d.ts +141 -0
- package/types/TUICallService/const/error.d.ts +2 -0
- package/types/TUICallService/const/index.d.ts +27 -0
- package/types/TUICallService/const/log.d.ts +7 -0
- package/types/TUICallService/index.d.ts +5 -0
- package/types/TUICallService/interface/ICallService.d.ts +69 -0
- package/types/TUICallService/interface/ICallStore.d.ts +47 -0
- package/types/TUICallService/interface/ITUIGlobal.d.ts +36 -0
- package/types/TUICallService/interface/ITUIStore.d.ts +83 -0
- package/types/TUICallService/interface/index.d.ts +4 -0
- package/types/TUICallService/locales/en.d.ts +128 -0
- package/types/TUICallService/locales/index.d.ts +10 -0
- package/types/TUICallService/locales/ja_JP.d.ts +127 -0
- package/types/TUICallService/locales/zh-cn.d.ts +123 -0
- package/types/TUICallService/serve/callManager.d.ts +11 -0
- package/types/TUICallService/utils/common-utils.d.ts +62 -0
- package/types/TUICallService/utils/decorators/promise-retry.d.ts +32 -0
- package/types/TUICallService/utils/env.d.ts +10 -0
- package/types/TUICallService/utils/index.d.ts +2 -0
- package/types/TUICallService/utils/is-empty.d.ts +2 -0
- package/types/TUICallService/utils/retry.d.ts +36 -0
- package/types/TUICallService/utils/timer.d.ts +63 -0
- package/types/TUICallService/utils/validate/avoidRepeatedCall.d.ts +10 -0
- package/types/TUICallService/utils/validate/index.d.ts +2 -0
- package/types/TUICallService/utils/validate/validateConfig.d.ts +173 -0
- package/types/TUICallService/utils/validate/validateParams.d.ts +1 -0
- package/types/TUICallService/utils/validate/validateStatus.d.ts +5 -0
- package/types/index.d.ts +11 -0
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import React, { CSSProperties, useEffect, useState } from 'react';
|
|
2
|
+
import { classPrefix, TObjectFit } from '../../../const/common';
|
|
3
|
+
import { classNames } from '../../../util/classnames';
|
|
4
|
+
import './Overlayer.scss';
|
|
5
|
+
|
|
6
|
+
interface IOverlayerProps {
|
|
7
|
+
style?: CSSProperties;
|
|
8
|
+
className?: string;
|
|
9
|
+
showOverlayer?: boolean;
|
|
10
|
+
background?: string;
|
|
11
|
+
fit?: TObjectFit;
|
|
12
|
+
defaultSrc?: string;
|
|
13
|
+
onError?: (event?: object) => void;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export default function Overlayer(props: IOverlayerProps) {
|
|
17
|
+
const {
|
|
18
|
+
style,
|
|
19
|
+
className,
|
|
20
|
+
background,
|
|
21
|
+
showOverlayer = true,
|
|
22
|
+
fit = 'cover',
|
|
23
|
+
defaultSrc,
|
|
24
|
+
onError,
|
|
25
|
+
} = props;
|
|
26
|
+
const classnames = classNames([
|
|
27
|
+
className,
|
|
28
|
+
`${classPrefix}-overlayer-container`,
|
|
29
|
+
]);
|
|
30
|
+
const [imgSrc, setImgSrc] = useState(background || defaultSrc);
|
|
31
|
+
const [objectFit, setObjectFit] = useState({ objectFit: fit });
|
|
32
|
+
const imgStyle = { width: '100%', height: '100%' };
|
|
33
|
+
|
|
34
|
+
useEffect(() => {
|
|
35
|
+
setObjectFit({ objectFit: fit });
|
|
36
|
+
}, [fit]);
|
|
37
|
+
|
|
38
|
+
function handleError(event) {
|
|
39
|
+
onError?.(event);
|
|
40
|
+
setImgSrc(defaultSrc);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
return (
|
|
44
|
+
<div className={classnames}>
|
|
45
|
+
{showOverlayer && <div style={style} className='overlay' />}
|
|
46
|
+
{imgSrc && <img alt='bg' style={{ ...imgStyle, ...objectFit }} src={imgSrc} onError={handleError} />}
|
|
47
|
+
</div>
|
|
48
|
+
);
|
|
49
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
@use "../../../style/theme/util" as *;
|
|
2
|
+
@import '../../../style/common/var.scss';
|
|
3
|
+
|
|
4
|
+
.#{$prefix}-popup__arrow {
|
|
5
|
+
left: 50%;
|
|
6
|
+
width: 10px;
|
|
7
|
+
height: 10px;
|
|
8
|
+
z-index: -1;
|
|
9
|
+
margin-top: -3px;
|
|
10
|
+
position: absolute;
|
|
11
|
+
@include theme() {
|
|
12
|
+
background-color: get(black-4);
|
|
13
|
+
border: 0.5px solid get(white-7);
|
|
14
|
+
}
|
|
15
|
+
backdrop-filter: blur(15px);
|
|
16
|
+
-webkit-backdrop-filter: blur(15px);
|
|
17
|
+
transform: rotate(45deg) translateX(-50%);
|
|
18
|
+
border-top-left-radius: 100%;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.#{$prefix}-popup__content {
|
|
22
|
+
backdrop-filter: blur(15px);
|
|
23
|
+
-webkit-backdrop-filter: blur(15px);
|
|
24
|
+
border-radius: 6px;
|
|
25
|
+
padding: 3px;
|
|
26
|
+
font-size: $font-size-m;
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
@include theme() {
|
|
30
|
+
background-color: get(black-4);
|
|
31
|
+
border: 0.5px solid get(white-7);
|
|
32
|
+
color: get(white-1);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import React, {
|
|
2
|
+
ReactNode, useCallback, useEffect, useRef, useState, forwardRef,
|
|
3
|
+
} from 'react';
|
|
4
|
+
import { usePopper } from 'react-popper';
|
|
5
|
+
import Portal from '../Portal/Portal';
|
|
6
|
+
import { classPrefix } from '../common';
|
|
7
|
+
import { classNames } from '../../../util/classnames';
|
|
8
|
+
import useMutationObserver from '../hooks/useMutationObserver';
|
|
9
|
+
import useOnClickOutSide from '../hooks/useOnClickOutSide';
|
|
10
|
+
import useControlled from '../hooks/useControlled';
|
|
11
|
+
import useTrigger from './hooks/useTrigger';
|
|
12
|
+
import './Popup.scss';
|
|
13
|
+
|
|
14
|
+
interface IPopupProps {
|
|
15
|
+
content?: ReactNode;
|
|
16
|
+
onVisibleChange?: (r: any) => any;
|
|
17
|
+
children: any;
|
|
18
|
+
visible?: boolean;
|
|
19
|
+
trigger?: 'hover' | 'click';
|
|
20
|
+
disabled?: boolean;
|
|
21
|
+
teleported?: boolean;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const Popup = forwardRef((props: IPopupProps, ref: any) => {
|
|
25
|
+
const {
|
|
26
|
+
children, content, trigger = 'hover', disabled = false, teleported = true,
|
|
27
|
+
} = props;
|
|
28
|
+
const [referenceElement, setReferenceElement] = useState(null);
|
|
29
|
+
const [popperElement, setPopperElement] = useState(null);
|
|
30
|
+
const [arrowElement, setArrowElement] = useState(null);
|
|
31
|
+
const contentRef = useRef(null); // The content section.
|
|
32
|
+
const updateTimeRef = useRef<any>();
|
|
33
|
+
const popupRef = useRef(null);
|
|
34
|
+
const { styles } = usePopper(referenceElement, popperElement, {
|
|
35
|
+
modifiers: [{ name: 'arrow', options: { element: arrowElement } }],
|
|
36
|
+
placement: 'top',
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
const [visible, onVisibleChange] = useControlled({
|
|
40
|
+
props,
|
|
41
|
+
key: 'visible',
|
|
42
|
+
onChange: props.onVisibleChange,
|
|
43
|
+
defaultOptions: { visible: false },
|
|
44
|
+
});
|
|
45
|
+
useOnClickOutSide([popupRef], () => visible && onVisibleChange(false));
|
|
46
|
+
const {
|
|
47
|
+
getTriggerNode, getPopupProps,
|
|
48
|
+
} = useTrigger({
|
|
49
|
+
trigger, disabled, visible, onVisibleChange,
|
|
50
|
+
});
|
|
51
|
+
// Listens for changes in the trigger node to dynamically update the position of the popup.
|
|
52
|
+
const cb = useCallback(() => {
|
|
53
|
+
clearTimeout(updateTimeRef.current);
|
|
54
|
+
updateTimeRef.current = setTimeout(() => popperElement?.update?.(), 0);
|
|
55
|
+
}, [popperElement, styles]);
|
|
56
|
+
useMutationObserver(referenceElement, cb);
|
|
57
|
+
useEffect(() => () => clearTimeout(updateTimeRef.current), []);
|
|
58
|
+
|
|
59
|
+
const triggerNode = React.cloneElement(getTriggerNode(children), { ref: setReferenceElement });
|
|
60
|
+
|
|
61
|
+
const overlayContent = (
|
|
62
|
+
<div style={{ ...styles.popper, paddingBottom: '10px' }} ref={setPopperElement} {...getPopupProps()}>
|
|
63
|
+
<div
|
|
64
|
+
ref={contentRef}
|
|
65
|
+
className={classNames(
|
|
66
|
+
`${classPrefix}-popup__content`,
|
|
67
|
+
)}
|
|
68
|
+
>
|
|
69
|
+
{content}
|
|
70
|
+
</div>
|
|
71
|
+
<div ref={arrowElement} style={styles.arrow} className={`${classPrefix}-popup__arrow`} />
|
|
72
|
+
</div>
|
|
73
|
+
);
|
|
74
|
+
|
|
75
|
+
const overlay = teleported ? (
|
|
76
|
+
<Portal>
|
|
77
|
+
{overlayContent}
|
|
78
|
+
</Portal>
|
|
79
|
+
) : (
|
|
80
|
+
overlayContent
|
|
81
|
+
);
|
|
82
|
+
|
|
83
|
+
return (
|
|
84
|
+
<div ref={popupRef}>
|
|
85
|
+
{triggerNode}
|
|
86
|
+
{visible && overlay}
|
|
87
|
+
</div>
|
|
88
|
+
);
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
export default Popup;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import React, { isValidElement, useRef } from 'react';
|
|
2
|
+
|
|
3
|
+
export default function useTrigger({
|
|
4
|
+
trigger, visible, disabled, onVisibleChange,
|
|
5
|
+
}) {
|
|
6
|
+
const visibleTimer = useRef<any>(null);
|
|
7
|
+
|
|
8
|
+
function getPopupProps(): any {
|
|
9
|
+
if (disabled) return {};
|
|
10
|
+
|
|
11
|
+
return {
|
|
12
|
+
onMouseEnter: () => {
|
|
13
|
+
if (trigger === 'hover') {
|
|
14
|
+
clearTimeout(visibleTimer.current);
|
|
15
|
+
onVisibleChange(true);
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
onMouseLeave: () => {
|
|
19
|
+
if (trigger === 'hover') {
|
|
20
|
+
clearTimeout(visibleTimer.current);
|
|
21
|
+
onVisibleChange(false);
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
function getTriggerProps(triggerNode) {
|
|
27
|
+
if (disabled) return {};
|
|
28
|
+
|
|
29
|
+
const triggerProps: any = {
|
|
30
|
+
onClick: (e) => {
|
|
31
|
+
if (trigger === 'click') {
|
|
32
|
+
onVisibleChange(!visible);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
triggerNode.props?.onClick?.(e);
|
|
36
|
+
},
|
|
37
|
+
onTouchStart: () => {
|
|
38
|
+
if (trigger === 'hover') {
|
|
39
|
+
onVisibleChange(true);
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
onMouseEnter: () => {
|
|
43
|
+
if (trigger === 'hover') {
|
|
44
|
+
onVisibleChange(true);
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
onMouseLeave: () => {
|
|
48
|
+
if (trigger === 'hover') {
|
|
49
|
+
onVisibleChange(false);
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
return triggerProps;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
function getTriggerNode(children) {
|
|
58
|
+
const triggerNode = isValidElement(children) ? children : <span className='t-trigger'>{children}</span>;
|
|
59
|
+
const triggerProps = getTriggerProps(triggerNode);
|
|
60
|
+
|
|
61
|
+
return React.cloneElement(triggerNode, triggerProps);
|
|
62
|
+
}
|
|
63
|
+
return {
|
|
64
|
+
getTriggerNode,
|
|
65
|
+
getPopupProps,
|
|
66
|
+
};
|
|
67
|
+
}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import React, {
|
|
2
|
+
forwardRef, useEffect, useMemo, useImperativeHandle, CSSProperties,
|
|
3
|
+
} from 'react';
|
|
4
|
+
import { createPortal } from 'react-dom';
|
|
5
|
+
import { AttachNode, AttachNodeReturnValue, classPrefix } from '../common';
|
|
6
|
+
import { canUseDocument } from '../util';
|
|
7
|
+
|
|
8
|
+
export interface PortalProps {
|
|
9
|
+
/**
|
|
10
|
+
* Specifies the HTML node to mount, with false being mounted on the body.
|
|
11
|
+
*/
|
|
12
|
+
attach?: React.ReactElement | AttachNode | boolean;
|
|
13
|
+
/**
|
|
14
|
+
* Trigger element.
|
|
15
|
+
*/
|
|
16
|
+
triggerNode?: HTMLElement;
|
|
17
|
+
children: React.ReactNode;
|
|
18
|
+
className?: string;
|
|
19
|
+
onClick?: (e: any) => any;
|
|
20
|
+
style?: CSSProperties;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export function getAttach(attach: PortalProps['attach'], triggerNode?: HTMLElement): AttachNodeReturnValue {
|
|
24
|
+
if (!canUseDocument) return null;
|
|
25
|
+
|
|
26
|
+
let el: AttachNodeReturnValue;
|
|
27
|
+
if (typeof attach === 'string') {
|
|
28
|
+
el = document.querySelector(attach);
|
|
29
|
+
}
|
|
30
|
+
if (typeof attach === 'function') {
|
|
31
|
+
el = attach(triggerNode);
|
|
32
|
+
}
|
|
33
|
+
if (typeof attach === 'object' && attach instanceof window.HTMLElement) {
|
|
34
|
+
el = attach;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
// fix el in iframe
|
|
38
|
+
if (el && el.nodeType === 1) return el;
|
|
39
|
+
|
|
40
|
+
return document.body;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
const Portal = forwardRef((props: PortalProps, ref) => {
|
|
44
|
+
const {
|
|
45
|
+
attach, children, triggerNode, className, style = {},
|
|
46
|
+
} = props;
|
|
47
|
+
|
|
48
|
+
const container = useMemo(() => {
|
|
49
|
+
if (!canUseDocument) return null;
|
|
50
|
+
const el = document.createElement('div');
|
|
51
|
+
el.className = `${classPrefix}-portal-wrapper ${className}`;
|
|
52
|
+
Object.keys(style).forEach((key) => {
|
|
53
|
+
el.style[key] = style[key];
|
|
54
|
+
});
|
|
55
|
+
return el;
|
|
56
|
+
}, [classPrefix, className]);
|
|
57
|
+
|
|
58
|
+
useEffect(() => {
|
|
59
|
+
const parentElement = getAttach(attach, triggerNode);
|
|
60
|
+
parentElement?.appendChild?.(container);
|
|
61
|
+
|
|
62
|
+
return () => {
|
|
63
|
+
parentElement?.removeChild?.(container);
|
|
64
|
+
};
|
|
65
|
+
}, [container, attach, triggerNode]);
|
|
66
|
+
|
|
67
|
+
useImperativeHandle(ref, () => container);
|
|
68
|
+
|
|
69
|
+
return createPortal(children, container);
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
Portal.displayName = 'Portal';
|
|
73
|
+
|
|
74
|
+
export default Portal;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
@import '../../../style/common/var.scss';
|
|
2
|
+
|
|
3
|
+
.#{$prefix}-text {
|
|
4
|
+
display: inline-block;
|
|
5
|
+
overflow: hidden;
|
|
6
|
+
text-align: center;
|
|
7
|
+
line-height: normal;
|
|
8
|
+
white-space: nowrap;
|
|
9
|
+
|
|
10
|
+
&.#{$prefix}-text--line-clamp {
|
|
11
|
+
display: -webkit-inline-box;
|
|
12
|
+
-webkit-box-orient: vertical;
|
|
13
|
+
white-space: normal;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { classNames } from '../../../util/classnames';
|
|
3
|
+
import { classPrefix } from '../common';
|
|
4
|
+
import './Text.scss';
|
|
5
|
+
|
|
6
|
+
interface IText {
|
|
7
|
+
maxWidth?: string;
|
|
8
|
+
truncated?: boolean;
|
|
9
|
+
lineClamp?: number;
|
|
10
|
+
className?: string;
|
|
11
|
+
children?: any;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export default function Text(props: IText) {
|
|
15
|
+
const {
|
|
16
|
+
maxWidth, truncated, lineClamp, children, className,
|
|
17
|
+
} = props;
|
|
18
|
+
|
|
19
|
+
const classnames = classNames([
|
|
20
|
+
className,
|
|
21
|
+
`${classPrefix}-text`,
|
|
22
|
+
]);
|
|
23
|
+
|
|
24
|
+
const style = {
|
|
25
|
+
maxWidth,
|
|
26
|
+
textOverflow: truncated ? 'ellipsis' : 'auto',
|
|
27
|
+
WebkitLineClamp: lineClamp,
|
|
28
|
+
};
|
|
29
|
+
return <span style={style} className={classnames}>{children}</span>;
|
|
30
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
@use "../../../style/theme/util" as *;
|
|
2
|
+
@import "../../../style/common/var.scss";
|
|
3
|
+
|
|
4
|
+
.#{$prefix}-time {
|
|
5
|
+
font-family: PingFang SC;
|
|
6
|
+
font-size: 16px;
|
|
7
|
+
font-weight: 500;
|
|
8
|
+
line-height: 20px;
|
|
9
|
+
letter-spacing: 0px;
|
|
10
|
+
text-align: center;
|
|
11
|
+
@include theme() {
|
|
12
|
+
color: get(white-1);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { classPrefix } from '../../../const/common';
|
|
3
|
+
import './Time.scss';
|
|
4
|
+
|
|
5
|
+
interface ITimeProps {
|
|
6
|
+
callDuration?: string;
|
|
7
|
+
style?: object;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export default function Time(props: ITimeProps) {
|
|
11
|
+
const { callDuration, style } = props;
|
|
12
|
+
return <div className={`${classPrefix}-time`} style={style}>{callDuration}</div>;
|
|
13
|
+
}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/* eslint-disable react/jsx-no-constructed-context-values */
|
|
2
|
+
import React, {
|
|
3
|
+
useMemo, useState, createContext, useEffect,
|
|
4
|
+
} from 'react';
|
|
5
|
+
import { classNames } from '../../../util/classnames';
|
|
6
|
+
import { classPrefix } from '../../../const/common';
|
|
7
|
+
import './ToggleWindow.scss';
|
|
8
|
+
|
|
9
|
+
function getNonSpecifiedElement<T>(array: T[], specified: T) {
|
|
10
|
+
for (let i = 0; i < array.length; i++) {
|
|
11
|
+
if (array[i] !== specified) {
|
|
12
|
+
return array[i];
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export const ToggleWindowContext = createContext({ bigWindow: null });
|
|
18
|
+
interface IToggleWindowProps {
|
|
19
|
+
bigWindow: string;
|
|
20
|
+
className?: string;
|
|
21
|
+
isMobile?: boolean;
|
|
22
|
+
showSmallWindow?: boolean;
|
|
23
|
+
children?: any;
|
|
24
|
+
onToggle?: (r?: any) => any;
|
|
25
|
+
}
|
|
26
|
+
export function ToggleWindow(props: IToggleWindowProps) {
|
|
27
|
+
const {
|
|
28
|
+
bigWindow: initBigWindow,
|
|
29
|
+
className,
|
|
30
|
+
isMobile,
|
|
31
|
+
showSmallWindow = true,
|
|
32
|
+
onToggle,
|
|
33
|
+
children = null,
|
|
34
|
+
} = props;
|
|
35
|
+
const [bigWindow, setBigWindow] = useState(initBigWindow);
|
|
36
|
+
|
|
37
|
+
useEffect(() => {
|
|
38
|
+
setBigWindow(initBigWindow);
|
|
39
|
+
}, [initBigWindow]);
|
|
40
|
+
|
|
41
|
+
const classnames = classNames([
|
|
42
|
+
`${classPrefix}-togglewindow-container`,
|
|
43
|
+
className,
|
|
44
|
+
]);
|
|
45
|
+
|
|
46
|
+
const filterChildren = useMemo(() => {
|
|
47
|
+
const toggleWindowChildren: any[] = [];
|
|
48
|
+
const values: string[] = [];
|
|
49
|
+
|
|
50
|
+
if (children) {
|
|
51
|
+
React.Children.map(children, (child) => {
|
|
52
|
+
if (child?.type?.displayName === 'ToggleWindowItem' && toggleWindowChildren.length < 2) {
|
|
53
|
+
// @ts-ignore
|
|
54
|
+
toggleWindowChildren.push(React.cloneElement(child, { isMobile, showSmallWindow }));
|
|
55
|
+
values.push(child?.props?.value);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
if (toggleWindowChildren.length >= 2) {
|
|
59
|
+
return null;
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
const updateBigWindow = () => {
|
|
65
|
+
setBigWindow((state) => {
|
|
66
|
+
const result = getNonSpecifiedElement<string>(values, state);
|
|
67
|
+
onToggle?.(result);
|
|
68
|
+
return result;
|
|
69
|
+
});
|
|
70
|
+
};
|
|
71
|
+
return toggleWindowChildren.map(
|
|
72
|
+
(child) => React.cloneElement(child, { updateBigWindow }),
|
|
73
|
+
);
|
|
74
|
+
}, [children]);
|
|
75
|
+
|
|
76
|
+
return (
|
|
77
|
+
<div className={classnames}>
|
|
78
|
+
<ToggleWindowContext.Provider value={{ bigWindow }}>
|
|
79
|
+
{filterChildren}
|
|
80
|
+
</ToggleWindowContext.Provider>
|
|
81
|
+
</div>
|
|
82
|
+
);
|
|
83
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
@use "../../../../style/theme/util" as *;
|
|
2
|
+
@import '../../../../style/common/var.scss';
|
|
3
|
+
|
|
4
|
+
.#{$prefix}-togglewindowitem-container {
|
|
5
|
+
position: absolute;
|
|
6
|
+
border-radius: 12px;
|
|
7
|
+
overflow: hidden;
|
|
8
|
+
|
|
9
|
+
&.mobile {
|
|
10
|
+
border-radius: 0;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
&.#{$prefix}-togglewindowitem-big {
|
|
14
|
+
top: 0;
|
|
15
|
+
left: 0;
|
|
16
|
+
right: 0;
|
|
17
|
+
bottom: 0;
|
|
18
|
+
width: 100%;
|
|
19
|
+
height: 100%;
|
|
20
|
+
|
|
21
|
+
@include theme() {
|
|
22
|
+
background-color: get(black-2);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
&.#{$prefix}-togglewindowitem-small {
|
|
27
|
+
top: 2%;
|
|
28
|
+
left: 2%;
|
|
29
|
+
width: 22%;
|
|
30
|
+
height: 21%;
|
|
31
|
+
z-index: 2;
|
|
32
|
+
border-radius: 12px;
|
|
33
|
+
@include theme() {
|
|
34
|
+
background-color: get(black-2);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
&.mobile {
|
|
38
|
+
// transform: translate(284px, 43.3281px);
|
|
39
|
+
width: 24.3%;
|
|
40
|
+
height: 19.7%;
|
|
41
|
+
// left: auto;
|
|
42
|
+
// right: 3.2vw;
|
|
43
|
+
// top: 3.7vh;
|
|
44
|
+
border-radius: 5px;
|
|
45
|
+
left: 98%;
|
|
46
|
+
position: absolute;
|
|
47
|
+
top: 8%;
|
|
48
|
+
transform: translateX(-100%);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import React, { useContext } from 'react';
|
|
2
|
+
import { classPrefix } from '../../../../const/common';
|
|
3
|
+
import { classNames } from '../../../../util/classnames';
|
|
4
|
+
import { ToggleWindowContext } from '../ToggleWindow';
|
|
5
|
+
import { Visibility } from '../../common';
|
|
6
|
+
import './ToggleWindowItem.scss';
|
|
7
|
+
|
|
8
|
+
interface IToggleWindowItem {
|
|
9
|
+
value?: string;
|
|
10
|
+
isMobile?: boolean;
|
|
11
|
+
children?: any;
|
|
12
|
+
className?: string;
|
|
13
|
+
updateBigWindow?: () => any;
|
|
14
|
+
showSmallWindow?: boolean;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export default function ToggleWindowItem(props: IToggleWindowItem) {
|
|
18
|
+
const {
|
|
19
|
+
children, value, isMobile, updateBigWindow, showSmallWindow, className,
|
|
20
|
+
} = props;
|
|
21
|
+
const { bigWindow } = useContext(ToggleWindowContext);
|
|
22
|
+
const isSmallWindow = bigWindow !== value;
|
|
23
|
+
const classnames = classNames([
|
|
24
|
+
className,
|
|
25
|
+
`${classPrefix}-togglewindowitem-container`,
|
|
26
|
+
`${classPrefix}-togglewindowitem-${isSmallWindow ? 'small' : 'big'}`,
|
|
27
|
+
{ mobile: isMobile },
|
|
28
|
+
]);
|
|
29
|
+
|
|
30
|
+
const render = () => {
|
|
31
|
+
let visibility: Visibility;
|
|
32
|
+
|
|
33
|
+
if (!showSmallWindow && isSmallWindow) {
|
|
34
|
+
visibility = 'hidden';
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
return (
|
|
38
|
+
<div
|
|
39
|
+
onClick={() => isSmallWindow && updateBigWindow()}
|
|
40
|
+
className={classnames}
|
|
41
|
+
style={{ visibility }}
|
|
42
|
+
>
|
|
43
|
+
{children}
|
|
44
|
+
</div>
|
|
45
|
+
);
|
|
46
|
+
};
|
|
47
|
+
return <>{render()}</>;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
ToggleWindowItem.displayName = 'ToggleWindowItem';
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
|
|
3
|
+
export const classPrefix = 'tk';
|
|
4
|
+
|
|
5
|
+
export type CSSSelector = string;
|
|
6
|
+
export type AttachNodeReturnValue = HTMLElement | Element | Document;
|
|
7
|
+
export type AttachNode = CSSSelector | ((triggerNode?: HTMLElement) => AttachNodeReturnValue);
|
|
8
|
+
|
|
9
|
+
export type TNode<T = undefined> = T extends undefined
|
|
10
|
+
? ReactNode
|
|
11
|
+
: ReactNode | ((props: T) => ReactNode);
|
|
12
|
+
|
|
13
|
+
export type Visibility = 'visible' | 'hidden';
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { useState } from 'react';
|
|
2
|
+
import { noop } from '../util';
|
|
3
|
+
|
|
4
|
+
interface IUseControlledProps<R, K> {
|
|
5
|
+
props: R
|
|
6
|
+
key: K;
|
|
7
|
+
onChange?: (e?: any) => any;
|
|
8
|
+
defaultOptions?: any
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export default function useControlled<R extends object, K extends keyof R>({
|
|
12
|
+
props, key, onChange, defaultOptions,
|
|
13
|
+
}: IUseControlledProps<R, K>) {
|
|
14
|
+
const controlled = Reflect.has(props, key);
|
|
15
|
+
const value = props[key];
|
|
16
|
+
const defaultValue = defaultOptions[key];
|
|
17
|
+
|
|
18
|
+
if (controlled) {
|
|
19
|
+
return [value, onChange || noop];
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
const [internalValue, setInternalValue] = useState(defaultValue);
|
|
23
|
+
|
|
24
|
+
return [
|
|
25
|
+
internalValue,
|
|
26
|
+
(newValue) => {
|
|
27
|
+
setInternalValue(newValue);
|
|
28
|
+
onChange?.(newValue);
|
|
29
|
+
},
|
|
30
|
+
];
|
|
31
|
+
}
|