@tencentcloud/chat-uikit-react 2.2.4 → 2.2.5

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 (54) hide show
  1. package/.babelrc +2 -2
  2. package/.eslintrc.js +125 -19
  3. package/.stylelintrc.js +17 -18
  4. package/CHANGELOG.md +11 -2
  5. package/README.md +8 -8
  6. package/dist/cjs/assets/fonts/iconfont.ttf +0 -0
  7. package/dist/cjs/assets/fonts/iconfont.woff +0 -0
  8. package/dist/cjs/assets/fonts/iconfont.woff2 +0 -0
  9. package/dist/cjs/components/ConversationPreview/ConversationPreviewContent.js +1 -1
  10. package/dist/cjs/components/ConversationPreview/utils.js +1 -1
  11. package/dist/cjs/context/TUIKitContext.js +1 -1
  12. package/dist/cjs/index.css +2 -1
  13. package/dist/cjs/index.d.css +643 -166
  14. package/dist/esm/assets/fonts/iconfont.ttf +0 -0
  15. package/dist/esm/assets/fonts/iconfont.woff +0 -0
  16. package/dist/esm/assets/fonts/iconfont.woff2 +0 -0
  17. package/dist/esm/components/ConversationPreview/ConversationPreviewContent.js +1 -1
  18. package/dist/esm/components/ConversationPreview/utils.js +1 -1
  19. package/dist/esm/context/TUIKitContext.js +1 -1
  20. package/dist/esm/index.css +2 -1
  21. package/dist/esm/index.d.css +643 -166
  22. package/package.json +7 -6
  23. package/rollup.config.js +13 -2
  24. package/src/assets/fonts/iconfont.ttf +0 -0
  25. package/src/assets/fonts/iconfont.woff +0 -0
  26. package/src/assets/fonts/iconfont.woff2 +0 -0
  27. package/src/components/ConversationCreate/styles/ConversationCreatGroupDetail.scss +16 -7
  28. package/src/components/ConversationCreate/styles/index.scss +23 -13
  29. package/src/components/ConversationPreview/ConversationPreviewContent.tsx +1 -2
  30. package/src/components/ConversationPreview/styles/index.scss +44 -14
  31. package/src/components/ConversationPreview/utils.tsx +36 -28
  32. package/src/components/Input/styles/index.scss +7 -5
  33. package/src/components/Model/styles/layout.scss +3 -3
  34. package/src/components/Plugins/styles/color.scss +17 -3
  35. package/src/components/Popup/styles/layout.scss +2 -1
  36. package/src/components/TUIChatHeader/styles/layout.scss +13 -2
  37. package/src/components/TUIConversationList/index.scss +25 -7
  38. package/src/components/TUIKit/TUIKit.tsx +3 -2
  39. package/src/components/TUIKit/styles/index.scss +27 -7
  40. package/src/components/TUIManage/styles/index.scss +16 -6
  41. package/src/components/TUIMessage/styles/color.scss +20 -9
  42. package/src/components/TUIMessage/styles/layout.scss +44 -11
  43. package/src/components/TUIMessageInput/styles/color.scss +25 -6
  44. package/src/components/TUIMessageInput/styles/layout.scss +58 -16
  45. package/src/components/TUIMessageList/styles/layout.scss +16 -2
  46. package/src/components/TUIProfile/styles/layout.scss +33 -16
  47. package/src/context/TUIKitContext.tsx +6 -1
  48. package/src/styles/colors/_color-dark.scss +35 -0
  49. package/src/styles/colors/_color-light.scss +35 -0
  50. package/src/styles/colors/_color-theme.scss +54 -0
  51. package/src/styles/fonts/icon-font.scss +18 -0
  52. package/src/styles/index.scss +4 -0
  53. package/src/styles/normalize.scss +355 -0
  54. package/src/components/TUIKit/styles/reset.scss +0 -67
@@ -1,24 +1,29 @@
1
+ @use "../../../styles/colors/color-theme" as *;
2
+
1
3
  // message input styles
2
4
  .tui-message-input {
3
5
  display: flex;
4
6
  flex-direction: column;
7
+
5
8
  &-main {
6
9
  flex: 1;
7
10
  display: flex;
8
11
  align-items: center;
9
12
  padding: 14px 12px;
10
13
  gap: 12px;
14
+
11
15
  .input-box {
12
16
  flex: 1;
13
17
  display: flex;
14
- padding: 0 8px;
15
18
  position: relative;
16
19
  min-height: 20px;
17
20
  max-height: 200px;
18
21
  border-radius: 15px;
19
22
  overflow: hidden;
20
23
  padding: 10px;
24
+
21
25
  .input-visibility-content {
26
+ min-height: 20px;
22
27
  word-break: break-all;
23
28
  visibility: hidden;
24
29
  max-width: -webkit-fill-available;
@@ -29,6 +34,7 @@
29
34
  line-height: 17px;
30
35
  padding: 1px 2px;
31
36
  }
37
+
32
38
  textarea {
33
39
  position: absolute;
34
40
  top: 0;
@@ -45,17 +51,24 @@
45
51
  resize: none;
46
52
  border: none;
47
53
  background: none;
48
- &:focus, &:active{
54
+
55
+ @include theme() {
56
+ color: get(text-primary);
57
+ }
58
+
59
+ &:focus,
60
+ &:active {
49
61
  border: none;
50
62
  outline: none;
51
63
  }
52
64
  }
53
65
  }
54
-
66
+
55
67
  .disabled {
56
68
  display: none;
57
69
  }
58
70
  }
71
+
59
72
  &-box {
60
73
  flex: 1;
61
74
  display: flex;
@@ -69,12 +82,14 @@ ul li {
69
82
 
70
83
  .input-plugin-popup {
71
84
  position: relative;
85
+
72
86
  &-box {
73
87
  position: absolute;
74
88
  z-index: 2;
75
89
  bottom: 30px;
76
90
  }
77
91
  }
92
+
78
93
  .input-plugin-item {
79
94
  font-style: normal;
80
95
  font-weight: 500;
@@ -82,12 +97,12 @@ ul li {
82
97
  font-family: PingFangSC-Medium;
83
98
  line-height: 19px;
84
99
  display: flex;
100
+
85
101
  span {
86
102
  padding: 0 17px;
87
103
  }
88
104
  }
89
105
 
90
-
91
106
  // emoji picker styles
92
107
  .emoji-picker {
93
108
  .face-list {
@@ -97,44 +112,53 @@ ul li {
97
112
  display: flex;
98
113
  flex-wrap: wrap;
99
114
  overflow-y: auto;
115
+
100
116
  &-item {
101
117
  padding: 5px;
102
118
  cursor: pointer;
119
+ user-select: none;
120
+
103
121
  img {
104
122
  width: 20px;
105
123
  }
124
+
106
125
  .face-img {
107
126
  width: 38px;
108
127
  }
109
128
  }
110
129
  }
130
+
111
131
  .face-tab {
112
132
  display: flex;
113
133
  align-items: center;
114
134
  min-width: 265px;
135
+
115
136
  &-item {
116
137
  cursor: pointer;
117
138
  width: 24px;
118
139
  padding: 10px;
140
+
119
141
  img {
120
142
  width: 100%;
121
143
  }
122
144
  }
123
145
  }
146
+
124
147
  .emoji-plugin-right {
125
148
  right: 0;
126
149
  }
127
150
  }
128
151
 
129
-
130
152
  // upload styles
131
153
  .upload-picker {
132
154
  position: relative;
133
155
  padding: 10px 16px;
134
156
  min-width: 180px;
157
+
135
158
  &:hover {
136
159
  color: #147aff;
137
160
  }
161
+
138
162
  input {
139
163
  position: absolute;
140
164
  cursor: pointer;
@@ -148,12 +172,13 @@ ul li {
148
172
 
149
173
  .input-quote {
150
174
  padding: 7px 16px;
151
- background: #F9F9F9;
175
+ background: #f9f9f9;
152
176
  display: flex;
153
177
  align-items: center;
178
+
154
179
  &-content {
155
180
  flex: 1;
156
- background: #FFFFFF;
181
+ background: #fff;
157
182
  padding: 2px 14px;
158
183
  position: relative;
159
184
  display: flex;
@@ -162,21 +187,24 @@ ul li {
162
187
  font-size: 14px;
163
188
  font-family: PingFangSC-Medium;
164
189
  line-height: 17px;
165
- color: #000000;
190
+ color: #000;
191
+
166
192
  &::before {
167
193
  content: "";
168
194
  position: absolute;
169
195
  width: 6px;
170
196
  height: 100%;
171
- background: #999999;
197
+ background: #999;
172
198
  top: 0;
173
199
  left: 0;
174
200
  }
201
+
175
202
  span {
176
203
  padding-top: 8px;
177
204
  opacity: 0.6;
178
205
  }
179
206
  }
207
+
180
208
  .icon {
181
209
  margin: 0 5px 0 16px;
182
210
  }
@@ -184,18 +212,20 @@ ul li {
184
212
 
185
213
  // TUIForward
186
214
  .tui-forward {
187
- background: #FFFFFF;
215
+ background: #fff;
188
216
  border-radius: 16px;
189
217
  display: flex;
190
218
  flex-direction: column;
191
219
  overflow: hidden;
192
220
  width: 300px;
193
221
  max-height: 90%;
222
+
194
223
  &-header {
195
224
  display: flex;
196
225
  align-items: center;
197
226
  padding: 24px 20px;
198
227
  }
228
+
199
229
  &-title {
200
230
  padding: 0 16px;
201
231
  font-family: PingFangSC-Medium;
@@ -204,10 +234,12 @@ ul li {
204
234
  font-size: 14px;
205
235
  line-height: 17px;
206
236
  }
237
+
207
238
  &-main {
208
239
  padding: 0 20px;
209
240
  max-height: calc(100vh - 200px);
210
241
  overflow-y: auto;
242
+
211
243
  .no-result {
212
244
  font-family: PingFangSC-Medium;
213
245
  font-size: 14px;
@@ -215,14 +247,17 @@ ul li {
215
247
  line-height: 20px;
216
248
  padding: 10px;
217
249
  text-align: center;
218
- color: #999999;
250
+ color: #999;
219
251
  }
220
252
  }
253
+
221
254
  &-search {
222
255
  padding: 10px 15px;
223
256
  }
257
+
224
258
  &-list {
225
259
  padding: 13px 0;
260
+
226
261
  &-title {
227
262
  font-family: PingFangSC-Medium;
228
263
  font-style: normal;
@@ -230,6 +265,7 @@ ul li {
230
265
  font-size: 14px;
231
266
  line-height: 20px;
232
267
  }
268
+
233
269
  &-item {
234
270
  padding: 6px 0;
235
271
  font-family: PingFangSC-Medium;
@@ -241,11 +277,13 @@ ul li {
241
277
  justify-content: space-between;
242
278
  align-items: center;
243
279
  width: 100%;
280
+
244
281
  .info {
245
282
  display: flex;
246
283
  align-items: center;
247
284
  flex-shrink: 0;
248
285
  width: 100%;
286
+
249
287
  &-nick {
250
288
  padding: 0 13px;
251
289
  font-family: PingFangSC-Medium;
@@ -263,15 +301,17 @@ ul li {
263
301
  }
264
302
  }
265
303
  }
304
+
266
305
  &-footer {
267
- background: rgba(249, 249, 249, 0.94);
306
+ background: rgba(249, 249, 249, 94%);
268
307
  padding: 13px 10px;
269
308
  display: flex;
270
309
  justify-content: space-between;
271
310
  align-items: center;
311
+
272
312
  .button {
273
313
  cursor: pointer;
274
- background: #0365F9;
314
+ background: #0365f9;
275
315
  border-radius: 31px;
276
316
  padding: 10px 21px;
277
317
  font-family: PingFangSC-Medium;
@@ -279,12 +319,13 @@ ul li {
279
319
  font-weight: 400;
280
320
  font-size: 14px;
281
321
  line-height: 20px;
282
- color: #FFFFFF;
322
+ color: #fff;
283
323
  border: none;
284
324
  }
325
+
285
326
  &-name {
286
327
  flex: 1;
287
- overflow : hidden;
328
+ overflow: hidden;
288
329
  word-break: break-all;
289
330
  text-overflow: ellipsis;
290
331
  display: -webkit-box;
@@ -296,7 +337,8 @@ ul li {
296
337
 
297
338
  .transmitter {
298
339
  padding: 0 10px;
340
+
299
341
  .icon-send {
300
342
  transform: rotate(90deg);
301
343
  }
302
- }
344
+ }
@@ -1,3 +1,5 @@
1
+ @use "../../../styles/colors/color-theme" as *;
2
+
1
3
  ul,li,div,p,label,span {
2
4
  margin: 0;
3
5
  padding: 0;
@@ -12,6 +14,11 @@ ul li {
12
14
  overflow-y: auto;
13
15
  position: relative;
14
16
  padding: 0 20px;
17
+
18
+ @include theme() {
19
+ background-color: get(bg-primary);
20
+ }
21
+
15
22
  &.hide {
16
23
  opacity: 0;
17
24
  }
@@ -26,15 +33,22 @@ ul li {
26
33
  font-style: normal;
27
34
  font-weight: 500;
28
35
  line-height: 17px;
29
- color: #999999;
36
+
37
+ @include theme() {
38
+ color: get(text-secondary);
39
+ }
40
+
30
41
  }
31
42
  &-time {
32
- color: #7a7a7a;
33
43
  font-family: PingFangSC-Medium;
34
44
  font-size: 12px;
35
45
  font-weight: 400;
36
46
  line-height: 14px;
37
47
  padding: 10px;
38
48
  text-align: center;
49
+
50
+ @include theme() {
51
+ color: get(text-secondary);
52
+ }
39
53
  }
40
54
  }
@@ -2,99 +2,116 @@
2
2
  display: flex;
3
3
  flex-direction: column;
4
4
  align-items: center;
5
- width: 30%;
6
- max-width: 360px;
7
- min-width: 360px;
8
- height: 100%;
5
+
9
6
  &-header {
10
7
  box-sizing: border-box;
11
8
  width: 100%;
12
- padding: 16px 20px;
9
+ padding: 15px;
13
10
  display: flex;
14
11
  align-items: center;
15
- line-height: 32px;
12
+
16
13
  h1 {
14
+ font-size: 16px;
17
15
  font-weight: 600;
18
16
  padding: 0 11px;
19
17
  }
20
18
  }
19
+
21
20
  &-main {
22
21
  max-width: 100%;
23
22
  box-sizing: border-box;
24
- padding: 20px;
23
+ padding: 10px 10px 0;
25
24
  display: flex;
26
25
  flex-direction: column;
27
26
  align-items: center;
28
27
  }
28
+
29
29
  &-avatar {
30
30
  margin: 13px 0;
31
31
  position: relative;
32
32
  }
33
+
33
34
  .displayFlex {
34
35
  display: flex;
35
36
  }
37
+
36
38
  &-nick {
37
39
  font-weight: 700;
38
40
  font-size: 24px;
39
41
  font-family: PingFangSC-Medium;
40
42
  line-height: 29px;
41
43
  text-align: center;
44
+
42
45
  .show {
43
46
  padding-left: 25px;
44
47
  }
45
48
  }
46
- &-ID{
49
+
50
+ &-ID {
47
51
  padding: 6px 0;
52
+ margin: 0;
48
53
  display: flex;
49
54
  align-items: center;
50
55
  font-weight: 400;
51
56
  font-size: 12px;
52
57
  font-family: PingFangSC-Medium;
53
58
  line-height: 14px;
54
- color: #666666;
59
+ color: #666;
60
+
61
+ h5 {
62
+ margin: 0;
63
+ }
55
64
  }
65
+
56
66
  &-list {
57
67
  box-sizing: border-box;
58
68
  width: 100%;
59
- padding: 0 20px;
69
+ padding: 0 15px;
60
70
  display: flex;
61
71
  flex-direction: column;
62
72
  user-select: none;
73
+
63
74
  &-item {
64
- padding: 20px 0 0;
75
+ padding: 0;
65
76
  cursor: pointer;
77
+
66
78
  h4 {
67
79
  padding-bottom: 3px;
68
80
  font-weight: 400;
69
81
  font-size: 16px;
70
82
  font-family: PingFangSC-Medium;
71
83
  line-height: 22px;
72
- color: rgba(0, 0, 0, 0.6);
84
+ margin: 10px 0;
85
+ color: rgba(0, 0, 0, 60%);
73
86
  }
74
87
  }
75
88
  }
89
+
76
90
  &-div-with-edit {
77
91
  padding: 4px 0;
78
- border-bottom: 1px solid #EEEEEE;
92
+ border-bottom: 1px solid #eee;
79
93
  }
94
+
80
95
  &-edit {
81
96
  border-bottom: none !important;
82
97
  }
83
98
  }
84
99
 
85
100
  .tui-profile-birthday {
86
- .react-date-picker__wrapper{
101
+ .react-date-picker__wrapper {
87
102
  display: none !important;
88
103
  }
104
+
89
105
  .react-date-picker__calendar {
90
106
  position: static !important;
107
+
91
108
  .react-calendar__navigation {
92
109
  height: 20px !important;
93
- margin-bottom: 0px;
110
+ margin-bottom: 0;
94
111
  }
95
112
  }
113
+
96
114
  &-calendar {
97
115
  border: none !important;
98
116
  }
99
117
  }
100
-
@@ -1,4 +1,4 @@
1
- import React, { PropsWithChildren, useContext } from 'react';
1
+ import React, { PropsWithChildren, useContext, useLayoutEffect } from 'react';
2
2
  import {
3
3
  ChatSDK,
4
4
  Conversation,
@@ -24,6 +24,11 @@ export const TUIKitContext = React.createContext<TUIKitContextValue | undefined>
24
24
  export function TUIKitProvider({ children, value }:PropsWithChildren<{
25
25
  value: TUIKitContextValue
26
26
  }>):React.ReactElement {
27
+
28
+ useLayoutEffect(() => {
29
+ document.documentElement.dataset.chatTheme = 'light';
30
+ }, []);
31
+
27
32
  return (
28
33
  <TUIKitContext.Provider value={(value as unknown) as TUIKitContextValue}>
29
34
  {children}
@@ -0,0 +1,35 @@
1
+ $dark-colors: (
2
+ // bg
3
+ --chat-theme-dark-bg-5: #76777e,
4
+ --chat-theme-dark-bg-4: #5d5e67,
5
+ --chat-theme-dark-bg-3: #454650,
6
+ --chat-theme-dark-bg-2: #2e303a,
7
+ --chat-theme-dark-bg-1: #191b26,
8
+ --chat-theme-dark-bg-primary: #191b26,
9
+ --chat-theme-dark-bg-secondary: #2e303a,
10
+ --chat-theme-dark-bg-active: #4e4e4e,
11
+ // text
12
+ --chat-theme-dark-text-5: #000,
13
+ --chat-theme-dark-text-4: #666,
14
+ --chat-theme-dark-text-3: #7a7a7a,
15
+ --chat-theme-dark-text-2: #7a7a7a,
16
+ --chat-theme-dark-text-1: #7a7a7a,
17
+ --chat-theme-dark-text-primary: #fff,
18
+ --chat-theme-dark-text-secondary: #8b8b8b,
19
+ // status
20
+ --chat-theme-dark-status-info: #147aff,
21
+ --chat-theme-dark-status-success: #34c759,
22
+ --chat-theme-dark-status-danger: #ff3742,
23
+ // border
24
+ --chat-theme-dark-border-5: #4e4e4e,
25
+ // box-shadow
26
+ --chat-theme-dark-box-shadow-1: (rgba(203, 203, 203, 0.755) 0 3px 8px),
27
+ );
28
+
29
+ :root {
30
+ @each $name, $color in $dark-colors {
31
+ #{$name}: $color;
32
+ }
33
+
34
+ color-scheme: light dark;
35
+ }
@@ -0,0 +1,35 @@
1
+ $light-colors: (
2
+ // bg
3
+ --chat-theme-light-bg-5: #999,
4
+ --chat-theme-light-bg-4: #b3b3b3,
5
+ --chat-theme-light-bg-3: #e5e7eb,
6
+ --chat-theme-light-bg-2: #f0f0f0,
7
+ --chat-theme-light-bg-1: #fff,
8
+ --chat-theme-light-bg-primary: #fff,
9
+ --chat-theme-light-bg-secondary: #f0f0f0,
10
+ --chat-theme-light-bg-active: #e6f1ff,
11
+ // text
12
+ --chat-theme-light-text-5: #000,
13
+ --chat-theme-light-text-4: #666,
14
+ --chat-theme-light-text-3: #7a7a7a,
15
+ --chat-theme-light-text-2: #7a7a7a,
16
+ --chat-theme-light-text-1: #7a7a7a,
17
+ --chat-theme-light-text-primary: #000,
18
+ --chat-theme-light-text-secondary: #7a7a7a,
19
+ // status
20
+ --chat-theme-light-status-info: #147aff,
21
+ --chat-theme-light-status-success: #34c759,
22
+ --chat-theme-light-status-danger: #ff3742,
23
+ // border
24
+ --chat-theme-light-border-5: #e0e0e0,
25
+ // box-shadow
26
+ --chat-theme-light-box-shadow-1: (rgba(0, 0, 0, 0.24) 0 3px 8px),
27
+ );
28
+
29
+ :root {
30
+ @each $name, $color in $light-colors {
31
+ #{$name}: $color;
32
+ }
33
+
34
+ color-scheme: light dark;
35
+ }
@@ -0,0 +1,54 @@
1
+ @use "sass:map";
2
+ @use "sass:list";
3
+
4
+ $prefix: "--chat-theme";
5
+
6
+ $themes: (
7
+ "light",
8
+ "dark",
9
+ );
10
+
11
+ $colors: (
12
+ "bg-5",
13
+ "bg-4",
14
+ "bg-3",
15
+ "bg-2",
16
+ "bg-1",
17
+ "bg-primary",
18
+ "bg-secondary",
19
+ "bg-active",
20
+ "text-5",
21
+ "text-4",
22
+ "text-3",
23
+ "text-2",
24
+ "text-1",
25
+ "text-primary",
26
+ "text-secondary",
27
+ "status-info",
28
+ "status-success",
29
+ "status-danger",
30
+ "border-5",
31
+ "box-shadow-1",
32
+ );
33
+
34
+ $color-map: ();
35
+
36
+ @mixin theme() {
37
+ @each $theme in $themes {
38
+
39
+ $color-map: () !global;
40
+
41
+ [data-chat-theme="#{$theme}"] & {
42
+ @each $color in $colors {
43
+ $value: #{$prefix}-#{$theme}-#{$color};
44
+ $color-map: map.merge($color-map, ($color: var($value))) !global;
45
+ }
46
+
47
+ @content;
48
+ }
49
+ }
50
+ }
51
+
52
+ @function get($color) {
53
+ @return map.get($color-map, $color);
54
+ }
@@ -0,0 +1,18 @@
1
+ @font-face {
2
+ font-family: iconfont;
3
+ src:
4
+ url("./assets/fonts/iconfont.woff2?t=1722856322648") format("woff2"),
5
+ url("./assets/fonts/iconfont.woff?t=1722856322648") format("woff"),
6
+ url("./assets/fonts/iconfont.ttf?t=1722856322648") format("truetype");
7
+ }
8
+
9
+ .iconfont {
10
+ font-family: iconfont, Arial, sans-serif !important;
11
+ font-size: 20px;
12
+ font-style: normal;
13
+ line-height: 1;
14
+ vertical-align: bottom;
15
+ -webkit-font-smoothing: antialiased;
16
+ -webkit-text-stroke-width: 0.2px;
17
+ -moz-osx-font-smoothing: grayscale;
18
+ }
@@ -0,0 +1,4 @@
1
+ @import "./normalize";
2
+ @import "./fonts/icon-font";
3
+ @import "./colors/color-light";
4
+ @import "./colors/color-dark";