mr-chat-bird 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 (49) hide show
  1. package/LICENCE +21 -0
  2. package/README.md +26 -0
  3. package/app/layout.tsx +69 -0
  4. package/app/page.tsx +9 -0
  5. package/dist/AddReaction-DCDVOMZB.svg +1 -0
  6. package/dist/TextFormat-R4ZVDKE2.svg +1 -0
  7. package/dist/index.css +388 -0
  8. package/dist/index.d.mts +5 -0
  9. package/dist/index.d.ts +5 -0
  10. package/dist/index.js +6425 -0
  11. package/dist/index.mjs +6420 -0
  12. package/eslint.config.mjs +11 -0
  13. package/index.ts +1 -0
  14. package/next-env.d.ts +5 -0
  15. package/next.config.mjs +30 -0
  16. package/package.json +69 -0
  17. package/postcss.config.cjs +14 -0
  18. package/public/favicon.svg +1 -0
  19. package/src/components/ChatUserList/ChatUserList.module.css +253 -0
  20. package/src/components/ChatUserList/ChatUserList.tsx +434 -0
  21. package/src/components/ChatUserList/ChatUserList.type.tsx +12 -0
  22. package/src/components/ChatUserList/ChatUserMessage.tsx +362 -0
  23. package/src/components/ChatUserList/users_list.json +648 -0
  24. package/src/components/ColorSchemeToggle/ColorSchemeToggle.tsx +15 -0
  25. package/src/components/EmojiPickerPopover/EmojiPickerPopover.tsx +72 -0
  26. package/src/components/MrChat/index.tsx +34 -0
  27. package/src/components/RichTextEditor/DropzoneMenuItem.tsx +33 -0
  28. package/src/components/RichTextEditor/EmojiNode.tsx +36 -0
  29. package/src/components/RichTextEditor/RichTextEditor.module.css +95 -0
  30. package/src/components/RichTextEditor/RichTextEditor.tsx +248 -0
  31. package/src/components/UserProfile/UserProfileDrawer.module.css +120 -0
  32. package/src/components/UserProfile/UserProfileDrawer.tsx +115 -0
  33. package/src/components/VirtualizedList/ChatScrollContainer.tsx +92 -0
  34. package/src/components/VirtualizedList/index.tsx +31 -0
  35. package/src/lib/axios.ts +12 -0
  36. package/src/lib/socket.ts +29 -0
  37. package/src/store/provider.tsx +8 -0
  38. package/src/store/slices/ChatSlice.ts +249 -0
  39. package/src/store/socket/index.tsx +32 -0
  40. package/src/store/store.ts +11 -0
  41. package/src/theme.ts +84 -0
  42. package/src/utils/environment.ts +5 -0
  43. package/src/utils/helper.ts +36 -0
  44. package/src/utils/icons/richText/Add.svg +1 -0
  45. package/src/utils/icons/richText/AddReaction.svg +1 -0
  46. package/src/utils/icons/richText/Docs.svg +1 -0
  47. package/src/utils/icons/richText/Image.svg +1 -0
  48. package/src/utils/icons/richText/TextFormat.svg +1 -0
  49. package/tsconfig.json +25 -0
@@ -0,0 +1,11 @@
1
+ import mantine from 'eslint-config-mantine';
2
+ import tseslint from 'typescript-eslint';
3
+
4
+ export default tseslint.config(
5
+ ...mantine,
6
+ { ignores: ['**/*.{mjs,cjs,js,d.ts,d.mts}'] },
7
+ {
8
+ files: ['**/*.story.tsx'],
9
+ rules: { 'no-console': 'off' },
10
+ }
11
+ );
package/index.ts ADDED
@@ -0,0 +1 @@
1
+ export { default as MrChat } from "./src/components/MrChat";
package/next-env.d.ts ADDED
@@ -0,0 +1,5 @@
1
+ /// <reference types="next" />
2
+ /// <reference types="next/image-types/global" />
3
+
4
+ // NOTE: This file should not be edited
5
+ // see https://nextjs.org/docs/app/api-reference/config/typescript for more information.
@@ -0,0 +1,30 @@
1
+ import bundleAnalyzer from '@next/bundle-analyzer';
2
+
3
+ const withBundleAnalyzer = bundleAnalyzer({
4
+ enabled: process.env.ANALYZE === 'true',
5
+ });
6
+
7
+ export default withBundleAnalyzer({
8
+ reactStrictMode: false,
9
+ eslint: {
10
+ ignoreDuringBuilds: true,
11
+ },
12
+ experimental: {
13
+ optimizePackageImports: ['@mantine/core', '@mantine/hooks'],
14
+ },
15
+ webpack(config) {
16
+ config.module.rules.push({
17
+ test: /\.svg$/,
18
+ issuer: /\.[jt]sx?$/,
19
+ use: [
20
+ {
21
+ loader: '@svgr/webpack',
22
+ options: {
23
+ exportType: 'default',
24
+ },
25
+ },
26
+ ],
27
+ });
28
+ return config;
29
+ },
30
+ });
package/package.json ADDED
@@ -0,0 +1,69 @@
1
+ {
2
+ "name": "mr-chat-bird",
3
+ "version": "1.0.0",
4
+ "private": false,
5
+ "main": "index.js",
6
+ "scripts": {
7
+ "build:npm": "tsup index.ts --format esm,cjs --dts",
8
+ "dev": "next dev",
9
+ "build": "next build",
10
+ "analyze": "ANALYZE=true next build",
11
+ "start": "next start"
12
+ },
13
+ "dependencies": {
14
+ "@emoji-mart/data": "^1.2.1",
15
+ "@emoji-mart/react": "^1.1.1",
16
+ "@mantine/core": "^8.1.3",
17
+ "@mantine/hooks": "^8.1.3",
18
+ "@mantine/notifications": "^8.2.1",
19
+ "@mantine/tiptap": "^8.1.3",
20
+ "@next/bundle-analyzer": "^15.3.3",
21
+ "@reduxjs/toolkit": "^2.8.2",
22
+ "@tabler/icons-react": "^3.34.0",
23
+ "@tiptap/extension-highlight": "^3.0.7",
24
+ "@tiptap/extension-link": "^3.0.7",
25
+ "@tiptap/extension-placeholder": "^3.0.7",
26
+ "@tiptap/extension-subscript": "^3.0.7",
27
+ "@tiptap/extension-superscript": "^3.0.7",
28
+ "@tiptap/extension-text-align": "^3.0.7",
29
+ "@tiptap/pm": "^3.0.7",
30
+ "@tiptap/react": "^3.0.7",
31
+ "@tiptap/starter-kit": "^3.0.7",
32
+ "axios": "^1.10.0",
33
+ "clsx": "^2.1.1",
34
+ "dompurify": "^3.3.3",
35
+ "emoji-mart": "^5.6.0",
36
+ "emoji-picker-react": "^4.13.2",
37
+ "next": "15.3.3",
38
+ "react": "19.1.0",
39
+ "react-dom": "19.1.0",
40
+ "react-dropzone": "^14.3.8",
41
+ "react-redux": "^9.2.0",
42
+ "react-virtuoso": "^4.18.3",
43
+ "socket.io-client": "^4.8.1",
44
+ "tsup": "^8.5.1"
45
+ },
46
+ "devDependencies": {
47
+ "@babel/core": "^7.27.4",
48
+ "@eslint/js": "^9.29.0",
49
+ "@ianvs/prettier-plugin-sort-imports": "^4.4.2",
50
+ "@svgr/webpack": "^8.1.0",
51
+ "@swc/core": "^1.15.40",
52
+ "@types/eslint-plugin-jsx-a11y": "^6",
53
+ "@types/node": "^22.13.11",
54
+ "@types/react": "19.1.8",
55
+ "babel-loader": "^10.0.0",
56
+ "eslint": "^9.29.0",
57
+ "eslint-config-mantine": "^4.0.3",
58
+ "eslint-plugin-jsx-a11y": "^6.10.2",
59
+ "eslint-plugin-react": "^7.37.5",
60
+ "postcss": "^8.5.5",
61
+ "postcss-preset-mantine": "1.17.0",
62
+ "postcss-simple-vars": "^7.0.1",
63
+ "prettier": "^3.5.3",
64
+ "stylelint": "^16.20.0",
65
+ "stylelint-config-standard-scss": "^15.0.1",
66
+ "typescript": "5.8.3",
67
+ "typescript-eslint": "^8.34.0"
68
+ }
69
+ }
@@ -0,0 +1,14 @@
1
+ module.exports = {
2
+ plugins: {
3
+ 'postcss-preset-mantine': {},
4
+ 'postcss-simple-vars': {
5
+ variables: {
6
+ 'mantine-breakpoint-xs': '36em',
7
+ 'mantine-breakpoint-sm': '48em',
8
+ 'mantine-breakpoint-md': '62em',
9
+ 'mantine-breakpoint-lg': '75em',
10
+ 'mantine-breakpoint-xl': '88em',
11
+ },
12
+ },
13
+ },
14
+ };
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 500 500"><g fill="none" fill-rule="evenodd"><rect width="500" height="500" fill="#339AF0" rx="250"/><g fill="#FFF"><path fill-rule="nonzero" d="M202.055 135.706c-6.26 8.373-4.494 20.208 3.944 26.42 29.122 21.45 45.824 54.253 45.824 90.005 0 35.752-16.702 68.559-45.824 90.005-8.436 6.215-10.206 18.043-3.944 26.42 6.26 8.378 18.173 10.13 26.611 3.916a153.835 153.835 0 0024.509-22.54h53.93c10.506 0 19.023-8.455 19.023-18.885 0-10.43-8.517-18.886-19.023-18.886h-29.79c8.196-18.594 12.553-38.923 12.553-60.03s-4.357-41.436-12.552-60.03h29.79c10.505 0 19.022-8.455 19.022-18.885 0-10.43-8.517-18.886-19.023-18.886h-53.93a153.835 153.835 0 00-24.509-22.54c-8.438-6.215-20.351-4.46-26.61 3.916z"/><path d="M171.992 246.492c0-15.572 12.624-28.195 28.196-28.195 15.572 0 28.195 12.623 28.195 28.195 0 15.572-12.623 28.196-28.195 28.196-15.572 0-28.196-12.624-28.196-28.196z"/></g></g></svg>
@@ -0,0 +1,253 @@
1
+ .chatWrapper {
2
+ display: flex;
3
+ flex-direction: column;
4
+ align-items: center;
5
+ height: 100vh;
6
+ background: #f1f3f5;
7
+ }
8
+
9
+ .chatContainer {
10
+ display: flex;
11
+ width: 100%;
12
+ max-width: 1260px;
13
+ background: white;
14
+ box-shadow: 0 0 10px rgba(0, 0, 0, 0.05);
15
+ border-radius: 8px;
16
+ overflow: hidden;
17
+ }
18
+
19
+ .sidebar {
20
+ width: 280px;
21
+ display: flex;
22
+ flex-direction: column;
23
+ height: 100vh;
24
+ border-right: 1px solid #eee;
25
+ background-color: #fff;
26
+ padding-top: 12px;
27
+ }
28
+
29
+ @media (max-width: 760px) {
30
+ .sidebar {
31
+ width: 180px;
32
+ }
33
+ }
34
+
35
+ .sidebarTop {
36
+ padding: 0 12px;
37
+ }
38
+
39
+ .topBar {
40
+ display: flex;
41
+ justify-content: space-between;
42
+ align-items: center;
43
+ /* padding-bottom: 12px; */
44
+ }
45
+
46
+ .topActions {
47
+ display: flex;
48
+ align-items: center;
49
+ gap: 10px;
50
+ }
51
+
52
+ .scrollWrapper {
53
+ flex: 1;
54
+ min-height: 0;
55
+ overflow: hidden;
56
+ }
57
+
58
+ .scrollArea {
59
+ flex: 1;
60
+ height: 100%;
61
+ overflow-y: auto;
62
+ }
63
+
64
+ .scrollArea :global(.mantine-ScrollArea-content) {
65
+ padding-bottom: 60px;
66
+ }
67
+
68
+ .avatar {
69
+ width: 34px;
70
+ height: 34px;
71
+ border-radius: 50%;
72
+ object-fit: cover;
73
+ }
74
+
75
+ .mainArea {
76
+ flex: 1;
77
+ display: flex;
78
+ flex-direction: column;
79
+ }
80
+
81
+ .messageArea {
82
+ flex: 1;
83
+ padding: 16px;
84
+ overflow-y: auto;
85
+ padding-bottom: 10px;
86
+ }
87
+
88
+ .messageBubble {
89
+ max-width: fit-content;
90
+ padding: 8px 45px 8px 16px;
91
+ margin-bottom: 8px;
92
+ position: relative;
93
+ }
94
+
95
+ .outgoing {
96
+ color: white;
97
+ background-color: #366ca4;
98
+ margin-left: auto;
99
+ }
100
+
101
+ .incoming {
102
+ background-color: #eeeeee;
103
+ margin-right: auto;
104
+ }
105
+
106
+ .inputBar {
107
+ display: flex;
108
+ align-items: end;
109
+ gap: 8px;
110
+ padding: 0px 16px 16px;
111
+ }
112
+
113
+ /* @media (max-width: 760px) {
114
+ .mainArea {
115
+ display: none;
116
+ }
117
+ } */
118
+
119
+ .chatItem {
120
+ display: flex;
121
+ align-items: center;
122
+ gap: 6px;
123
+ padding: 8px 12px;
124
+ cursor: pointer;
125
+ transition: background 0.2s;
126
+ margin: 2px 4px;
127
+ border-radius: 6px;
128
+ }
129
+
130
+ .chatItem:hover {
131
+ background-color: #f6f6f6;
132
+ }
133
+
134
+ .chatLabelItem {
135
+ font-size: 15px;
136
+ }
137
+
138
+ .chatHeader {
139
+ display: flex;
140
+ justify-content: space-between;
141
+ align-items: center;
142
+ padding: 12px 16px;
143
+ border-bottom: 1px solid #eee;
144
+ background-color: #f8f9fa;
145
+ position: sticky;
146
+ top: 0;
147
+ z-index: 2;
148
+ min-height: 63px;
149
+ }
150
+
151
+ .receiverInfo {
152
+ display: flex;
153
+ align-items: center;
154
+ gap: 12px;
155
+ cursor: pointer;
156
+ }
157
+
158
+ .emptyState {
159
+ height: 100%;
160
+ display: flex;
161
+ align-items: center;
162
+ justify-content: center;
163
+ }
164
+
165
+ .encryptionMinimal {
166
+ display: flex;
167
+ align-items: center;
168
+ gap: 6px;
169
+ padding: 6px 10px;
170
+ border-radius: 12px;
171
+ background: rgba(0, 0, 0, 0.04);
172
+ color: #666;
173
+ font-size: 12px;
174
+ }
175
+
176
+ .encryptionText {
177
+ font-size: 16px;
178
+ color: #666;
179
+ margin-left: 3px;
180
+ }
181
+
182
+ .messageContent {
183
+ max-width: 370px;
184
+ word-wrap: break-word;
185
+ font-size: 14px;
186
+ }
187
+
188
+ .messagePreviewContent p,
189
+ .messageContent p {
190
+ margin: 0;
191
+ padding: 0;
192
+ }
193
+
194
+ .activeChatItem {
195
+ background-color: #eee;
196
+ }
197
+
198
+ .chatItem:hover {
199
+ background-color: #eee;
200
+ }
201
+
202
+ .messageTime {
203
+ font-size: 11px;
204
+ opacity: 0.6;
205
+ text-align: right;
206
+ margin-top: 4px;
207
+ position: absolute;
208
+ bottom: 4px;
209
+ right: 8px;
210
+ z-index: 1;
211
+ }
212
+
213
+ .dateSeparator {
214
+ text-align: center;
215
+ font-size: 13px;
216
+ margin: 12px 0;
217
+ color: #888;
218
+ }
219
+
220
+ .chatInfo {
221
+ width: 100%;
222
+ position: relative;
223
+ }
224
+
225
+ .messagePreview {
226
+ display: flex;
227
+ justify-content: space-between;
228
+ align-items: end;
229
+ margin-top: 1px;
230
+ }
231
+
232
+ .messagePreviewTime {
233
+ position: relative;
234
+ top: 1px;
235
+ right: 0;
236
+ }
237
+
238
+ .unreadBadge {
239
+ background: #366ca4;
240
+ color: white;
241
+ font-size: 10px;
242
+ border-radius: 50%;
243
+ padding: 3px 5px;
244
+ min-width: 18px;
245
+ text-align: center;
246
+ position: absolute;
247
+ top: 1px;
248
+ right: 0px;
249
+ }
250
+
251
+ .messagePreviewContent {
252
+ font-size: 14px;
253
+ }