movius-chats 1.0.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.
Files changed (150) hide show
  1. package/README.md +249 -0
  2. package/lib/commonjs/assets/Icons/ArrowBack2RoundedIcon.js +2 -0
  3. package/lib/commonjs/assets/Icons/ArrowBack2RoundedIcon.js.map +1 -0
  4. package/lib/commonjs/assets/Icons/CameraIcon.js +2 -0
  5. package/lib/commonjs/assets/Icons/CameraIcon.js.map +1 -0
  6. package/lib/commonjs/assets/Icons/CheckAllIcon.js +2 -0
  7. package/lib/commonjs/assets/Icons/CheckAllIcon.js.map +1 -0
  8. package/lib/commonjs/assets/Icons/CheckIcon.js +2 -0
  9. package/lib/commonjs/assets/Icons/CheckIcon.js.map +1 -0
  10. package/lib/commonjs/assets/Icons/EmojiFunnySquareIcon.js +2 -0
  11. package/lib/commonjs/assets/Icons/EmojiFunnySquareIcon.js.map +1 -0
  12. package/lib/commonjs/assets/Icons/LoadingIcon.js +2 -0
  13. package/lib/commonjs/assets/Icons/LoadingIcon.js.map +1 -0
  14. package/lib/commonjs/assets/Icons/MicrophoneIcon.js +2 -0
  15. package/lib/commonjs/assets/Icons/MicrophoneIcon.js.map +1 -0
  16. package/lib/commonjs/assets/Icons/PaperClipIcon.js +2 -0
  17. package/lib/commonjs/assets/Icons/PaperClipIcon.js.map +1 -0
  18. package/lib/commonjs/assets/Icons/PaperPlaneIcon.js +2 -0
  19. package/lib/commonjs/assets/Icons/PaperPlaneIcon.js.map +1 -0
  20. package/lib/commonjs/assets/Icons/PauseIcon.js +2 -0
  21. package/lib/commonjs/assets/Icons/PauseIcon.js.map +1 -0
  22. package/lib/commonjs/assets/Icons/PlayIcon.js +2 -0
  23. package/lib/commonjs/assets/Icons/PlayIcon.js.map +1 -0
  24. package/lib/commonjs/assets/Icons/XIcon.js +2 -0
  25. package/lib/commonjs/assets/Icons/XIcon.js.map +1 -0
  26. package/lib/commonjs/components/AudioPlayer/AudioPlayer.js +2 -0
  27. package/lib/commonjs/components/AudioPlayer/AudioPlayer.js.map +1 -0
  28. package/lib/commonjs/components/ChatBubble/ChatBubble.js +2 -0
  29. package/lib/commonjs/components/ChatBubble/ChatBubble.js.map +1 -0
  30. package/lib/commonjs/components/ChatBubble/MessageContent.js +2 -0
  31. package/lib/commonjs/components/ChatBubble/MessageContent.js.map +1 -0
  32. package/lib/commonjs/components/ChatBubble/MessageStatus.js +2 -0
  33. package/lib/commonjs/components/ChatBubble/MessageStatus.js.map +1 -0
  34. package/lib/commonjs/components/ChatInput/ChatInput.js +2 -0
  35. package/lib/commonjs/components/ChatInput/ChatInput.js.map +1 -0
  36. package/lib/commonjs/components/MediaViewer/MediaViewer.js +2 -0
  37. package/lib/commonjs/components/MediaViewer/MediaViewer.js.map +1 -0
  38. package/lib/commonjs/components/TypingComponent/TypingIndicator.js +2 -0
  39. package/lib/commonjs/components/TypingComponent/TypingIndicator.js.map +1 -0
  40. package/lib/commonjs/context/AudioContext.js +2 -0
  41. package/lib/commonjs/context/AudioContext.js.map +1 -0
  42. package/lib/commonjs/context/ChatContext.js +2 -0
  43. package/lib/commonjs/context/ChatContext.js.map +1 -0
  44. package/lib/commonjs/index.js +2 -0
  45. package/lib/commonjs/index.js.map +1 -0
  46. package/lib/commonjs/utils/datefunc.js +2 -0
  47. package/lib/commonjs/utils/datefunc.js.map +1 -0
  48. package/lib/module/assets/Icons/ArrowBack2RoundedIcon.js +2 -0
  49. package/lib/module/assets/Icons/ArrowBack2RoundedIcon.js.map +1 -0
  50. package/lib/module/assets/Icons/CameraIcon.js +2 -0
  51. package/lib/module/assets/Icons/CameraIcon.js.map +1 -0
  52. package/lib/module/assets/Icons/CheckAllIcon.js +2 -0
  53. package/lib/module/assets/Icons/CheckAllIcon.js.map +1 -0
  54. package/lib/module/assets/Icons/CheckIcon.js +2 -0
  55. package/lib/module/assets/Icons/CheckIcon.js.map +1 -0
  56. package/lib/module/assets/Icons/EmojiFunnySquareIcon.js +2 -0
  57. package/lib/module/assets/Icons/EmojiFunnySquareIcon.js.map +1 -0
  58. package/lib/module/assets/Icons/LoadingIcon.js +2 -0
  59. package/lib/module/assets/Icons/LoadingIcon.js.map +1 -0
  60. package/lib/module/assets/Icons/MicrophoneIcon.js +2 -0
  61. package/lib/module/assets/Icons/MicrophoneIcon.js.map +1 -0
  62. package/lib/module/assets/Icons/PaperClipIcon.js +2 -0
  63. package/lib/module/assets/Icons/PaperClipIcon.js.map +1 -0
  64. package/lib/module/assets/Icons/PaperPlaneIcon.js +2 -0
  65. package/lib/module/assets/Icons/PaperPlaneIcon.js.map +1 -0
  66. package/lib/module/assets/Icons/PauseIcon.js +2 -0
  67. package/lib/module/assets/Icons/PauseIcon.js.map +1 -0
  68. package/lib/module/assets/Icons/PlayIcon.js +2 -0
  69. package/lib/module/assets/Icons/PlayIcon.js.map +1 -0
  70. package/lib/module/assets/Icons/XIcon.js +2 -0
  71. package/lib/module/assets/Icons/XIcon.js.map +1 -0
  72. package/lib/module/components/AudioPlayer/AudioPlayer.js +2 -0
  73. package/lib/module/components/AudioPlayer/AudioPlayer.js.map +1 -0
  74. package/lib/module/components/ChatBubble/ChatBubble.js +2 -0
  75. package/lib/module/components/ChatBubble/ChatBubble.js.map +1 -0
  76. package/lib/module/components/ChatBubble/MessageContent.js +2 -0
  77. package/lib/module/components/ChatBubble/MessageContent.js.map +1 -0
  78. package/lib/module/components/ChatBubble/MessageStatus.js +2 -0
  79. package/lib/module/components/ChatBubble/MessageStatus.js.map +1 -0
  80. package/lib/module/components/ChatInput/ChatInput.js +2 -0
  81. package/lib/module/components/ChatInput/ChatInput.js.map +1 -0
  82. package/lib/module/components/MediaViewer/MediaViewer.js +2 -0
  83. package/lib/module/components/MediaViewer/MediaViewer.js.map +1 -0
  84. package/lib/module/components/TypingComponent/TypingIndicator.js +2 -0
  85. package/lib/module/components/TypingComponent/TypingIndicator.js.map +1 -0
  86. package/lib/module/context/AudioContext.js +2 -0
  87. package/lib/module/context/AudioContext.js.map +1 -0
  88. package/lib/module/context/ChatContext.js +2 -0
  89. package/lib/module/context/ChatContext.js.map +1 -0
  90. package/lib/module/index.js +2 -0
  91. package/lib/module/index.js.map +1 -0
  92. package/lib/module/utils/datefunc.js +2 -0
  93. package/lib/module/utils/datefunc.js.map +1 -0
  94. package/lib/typescript/assets/Icons/ArrowBack2RoundedIcon.d.ts +5 -0
  95. package/lib/typescript/assets/Icons/CameraIcon.d.ts +5 -0
  96. package/lib/typescript/assets/Icons/CheckAllIcon.d.ts +4 -0
  97. package/lib/typescript/assets/Icons/CheckIcon.d.ts +4 -0
  98. package/lib/typescript/assets/Icons/EmojiFunnySquareIcon.d.ts +5 -0
  99. package/lib/typescript/assets/Icons/LoadingIcon.d.ts +4 -0
  100. package/lib/typescript/assets/Icons/MicrophoneIcon.d.ts +5 -0
  101. package/lib/typescript/assets/Icons/PaperClipIcon.d.ts +5 -0
  102. package/lib/typescript/assets/Icons/PaperPlaneIcon.d.ts +5 -0
  103. package/lib/typescript/assets/Icons/PauseIcon.d.ts +5 -0
  104. package/lib/typescript/assets/Icons/PlayIcon.d.ts +5 -0
  105. package/lib/typescript/assets/Icons/XIcon.d.ts +4 -0
  106. package/lib/typescript/components/AudioPlayer/AudioPlayer.d.ts +4 -0
  107. package/lib/typescript/components/AudioPlayer/types.d.ts +5 -0
  108. package/lib/typescript/components/ChatBubble/ChatBubble.d.ts +4 -0
  109. package/lib/typescript/components/ChatBubble/MessageContent.d.ts +4 -0
  110. package/lib/typescript/components/ChatBubble/MessageStatus.d.ts +4 -0
  111. package/lib/typescript/components/ChatBubble/types.d.ts +18 -0
  112. package/lib/typescript/components/ChatInput/ChatInput.d.ts +4 -0
  113. package/lib/typescript/components/ChatInput/types.d.ts +20 -0
  114. package/lib/typescript/components/MediaViewer/MediaViewer.d.ts +4 -0
  115. package/lib/typescript/components/MediaViewer/types.d.ts +5 -0
  116. package/lib/typescript/components/TypingComponent/TypingIndicator.d.ts +11 -0
  117. package/lib/typescript/context/AudioContext.d.ts +10 -0
  118. package/lib/typescript/context/ChatContext.d.ts +19 -0
  119. package/lib/typescript/index.d.ts +4 -0
  120. package/lib/typescript/types/index.d.ts +85 -0
  121. package/lib/typescript/utils/datefunc.d.ts +1 -0
  122. package/package.json +93 -0
  123. package/src/assets/Icons/ArrowBack2RoundedIcon.tsx +25 -0
  124. package/src/assets/Icons/CameraIcon.tsx +20 -0
  125. package/src/assets/Icons/CheckAllIcon.tsx +13 -0
  126. package/src/assets/Icons/CheckIcon.tsx +11 -0
  127. package/src/assets/Icons/EmojiFunnySquareIcon.tsx +41 -0
  128. package/src/assets/Icons/LoadingIcon.tsx +15 -0
  129. package/src/assets/Icons/MicrophoneIcon.tsx +24 -0
  130. package/src/assets/Icons/PaperClipIcon.tsx +17 -0
  131. package/src/assets/Icons/PaperPlaneIcon.tsx +24 -0
  132. package/src/assets/Icons/PauseIcon.tsx +21 -0
  133. package/src/assets/Icons/PlayIcon.tsx +20 -0
  134. package/src/assets/Icons/XIcon.tsx +20 -0
  135. package/src/components/AudioPlayer/AudioPlayer.tsx +259 -0
  136. package/src/components/AudioPlayer/types.ts +5 -0
  137. package/src/components/ChatBubble/ChatBubble.tsx +137 -0
  138. package/src/components/ChatBubble/MessageContent.tsx +143 -0
  139. package/src/components/ChatBubble/MessageStatus.tsx +68 -0
  140. package/src/components/ChatBubble/types.ts +21 -0
  141. package/src/components/ChatInput/ChatInput.tsx +207 -0
  142. package/src/components/ChatInput/types.ts +22 -0
  143. package/src/components/MediaViewer/MediaViewer.tsx +101 -0
  144. package/src/components/MediaViewer/types.ts +5 -0
  145. package/src/components/TypingComponent/TypingIndicator.tsx +119 -0
  146. package/src/context/AudioContext.tsx +30 -0
  147. package/src/context/ChatContext.tsx +40 -0
  148. package/src/index.tsx +103 -0
  149. package/src/types/index.ts +94 -0
  150. package/src/utils/datefunc.ts +5 -0
@@ -0,0 +1,94 @@
1
+ import { ImageStyle, TextStyle, ViewStyle } from "react-native";
2
+
3
+ export interface Message {
4
+ id: string;
5
+ text?: string;
6
+ image?: string;
7
+ video?: string;
8
+ audio?: string;
9
+ senderId: string;
10
+ time: string;
11
+ status: "read" | "delivered" | "sent";
12
+ senderName?: string;
13
+ senderAvatar?: string;
14
+ }
15
+
16
+ export interface ChatScreenProps {
17
+ // Message handling
18
+ messages: Message[];
19
+ currentUserId: string;
20
+ onSendMessage: (message: Omit<Message, "id" | "time" | "status">) => void;
21
+ onMessageLongPress?: (message: Message) => void;
22
+ onAttachmentPress?: () => void;
23
+ onAudioRecordEnd?: () => void;
24
+ onAudioRecordStart?: () => void;
25
+ onCameraPress?: () => void;
26
+
27
+ // Typing indicators and input
28
+ typingUsers?: Array<{ id: string; avatar: string; name: string }>;
29
+ onTypingStart?: () => void;
30
+ onTypingEnd?: () => void;
31
+ placeholder?: string;
32
+
33
+ // UI Customization
34
+ theme?: {
35
+ colors?: {
36
+ sentMessageTailColor?: string;
37
+ receivedMessageTailColor?: string;
38
+ timestamp?: string;
39
+ inputsIconsColor?: string;
40
+ sendIconsColor?: string;
41
+ placeholderTextColor?: string;
42
+ audioPlayIconColor?: string;
43
+ audioPauseIconColor?: string;
44
+ videoPlayIconColor?: string;
45
+ };
46
+ bubbleStyle?: {
47
+ sent?: ViewStyle;
48
+ received?: ViewStyle;
49
+ avatarTextStyle?: TextStyle;
50
+ userNameStyle?: TextStyle;
51
+ avatarImageStyle?: ImageStyle;
52
+ typingContainerStyle?: ViewStyle;
53
+ additionalTypingUsersContainerStyle?: ViewStyle;
54
+ additionalTypingUsersTextStyle?: TextStyle;
55
+ };
56
+ messageStyle?: {
57
+ textStyle?: TextStyle;
58
+ audioPlayButtonStyle?: ViewStyle;
59
+ audioKnobStyle?: ViewStyle;
60
+ progressBarStyle?: ViewStyle;
61
+ activeProgressBarStyle?: ViewStyle;
62
+ audioDurationStyle?: TextStyle;
63
+ };
64
+ inputStyles?: {
65
+ inputSectionContainerStyle?: ViewStyle;
66
+ inputContainerStyle?: ViewStyle;
67
+ sendButtonStyle?: ViewStyle;
68
+ };
69
+ };
70
+
71
+ // Feature flags
72
+ showAvatars?: boolean;
73
+ showUserNames?: boolean;
74
+ showEmojiButton?: boolean;
75
+ showAttachmentsButton?: boolean;
76
+ showCameraButton?: boolean;
77
+ showVoiceRecordButton?: boolean;
78
+ showBubbleTail?: boolean;
79
+ showMessageStatus?: boolean;
80
+
81
+ // Custom components
82
+ renderCustomInput?: () => React.ReactNode;
83
+ renderCustomVideoBubbleError?: () => React.ReactNode;
84
+ renderCustomTyping?: () => React.ReactNode;
85
+
86
+ // Custom icon props
87
+ CustomEmojiIcon?: () => React.ReactNode;
88
+ CustomAttachmentIcon?: () => React.ReactNode;
89
+ CustomCameraIcon?: () => React.ReactNode;
90
+ CustomSendIcon?: () => React.ReactNode;
91
+ CustomMicrophoneIcon?: () => React.ReactNode;
92
+ CustomPlayIcon?: () => React.ReactNode;
93
+ CustomPauseIcon?: () => React.ReactNode;
94
+ }
@@ -0,0 +1,5 @@
1
+ export const formatDuration = (time: number) => {
2
+ const minutes = Math.floor(time / 60);
3
+ const seconds = Math.floor(time % 60);
4
+ return `${minutes}:${seconds < 10 ? "0" : ""}${seconds}`;
5
+ };