react-peer-chat 0.3.0 → 0.3.1
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/build/index.d.ts +3 -2
- package/build/index.js +7 -8
- package/package.json +1 -1
package/build/index.d.ts
CHANGED
|
@@ -26,7 +26,8 @@ type Props = {
|
|
|
26
26
|
dialogOptions?: DialogOptions;
|
|
27
27
|
onError?: () => void;
|
|
28
28
|
children?: (childrenOptions: ChildrenOptions) => ReactNode;
|
|
29
|
-
|
|
30
|
-
|
|
29
|
+
props: DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>;
|
|
30
|
+
};
|
|
31
|
+
export default function Chat({ name, peerId, remotePeerId, peerOptions, text, voice, dialogOptions, onError, children, props }: Props): React.JSX.Element;
|
|
31
32
|
export declare const clearChat: () => void;
|
|
32
33
|
export {};
|
package/build/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { useEffect, useRef, useState } from 'react';
|
|
2
2
|
import useStorage, { removeStorage } from './storage.js';
|
|
3
3
|
import { BiSolidMessageDetail, BiSolidMessageX, BsFillMicFill, BsFillMicMuteFill, GrSend } from './icons.js';
|
|
4
|
-
export default function Chat({ name, peerId, remotePeerId, peerOptions, text = true, voice = true, dialogOptions, onError = () => console.error("Can not access microphone!"), children,
|
|
4
|
+
export default function Chat({ name, peerId, remotePeerId, peerOptions, text = true, voice = true, dialogOptions, onError = () => console.error("Can not access microphone!"), children, props }) {
|
|
5
5
|
const [peer, setPeer] = useState();
|
|
6
6
|
const [opponentName, setOpponentName] = useState();
|
|
7
7
|
const [notification, setNotification] = useState(false);
|
|
@@ -115,13 +115,12 @@ export default function Chat({ name, peerId, remotePeerId, peerOptions, text = t
|
|
|
115
115
|
return React.createElement("div", { className: 'rpc-main', ...props },
|
|
116
116
|
typeof children === 'function' ? children({ opponentName, messages, addMessage, audio, setAudio }) : React.createElement(React.Fragment, null,
|
|
117
117
|
text && React.createElement("div", null,
|
|
118
|
-
dialog ? React.createElement(BiSolidMessageX, { onClick: () => setDialog(false) })
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
notification && React.createElement("span", { className: 'rpc-badge' })),
|
|
118
|
+
dialog ? React.createElement(BiSolidMessageX, { onClick: () => setDialog(false) }) : React.createElement("div", { className: 'rpc-notification' },
|
|
119
|
+
React.createElement(BiSolidMessageDetail, { onClick: () => {
|
|
120
|
+
setNotification(false);
|
|
121
|
+
setDialog(true);
|
|
122
|
+
} }),
|
|
123
|
+
notification && React.createElement("span", { className: 'rpc-badge' })),
|
|
125
124
|
React.createElement("dialog", { ref: dialogRef, className: `${dialog ? 'rpc-dialog' : ''} rpc-position-${(dialogOptions === null || dialogOptions === void 0 ? void 0 : dialogOptions.position) || 'center'}`, style: dialogOptions === null || dialogOptions === void 0 ? void 0 : dialogOptions.style },
|
|
126
125
|
React.createElement("div", { className: 'rpc-heading' }, "Chat"),
|
|
127
126
|
React.createElement("hr", null),
|