funda-ui 4.6.151 → 4.6.333
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/Chatbox/index.css +88 -14
- package/Chatbox/index.d.ts +5 -0
- package/Chatbox/index.js +457 -281
- package/Utils/format-string.d.ts +64 -0
- package/Utils/format-string.js +157 -0
- package/lib/cjs/Chatbox/index.d.ts +5 -0
- package/lib/cjs/Chatbox/index.js +457 -281
- package/lib/cjs/Utils/format-string.d.ts +64 -0
- package/lib/cjs/Utils/format-string.js +157 -0
- package/lib/css/Chatbox/index.css +88 -14
- package/lib/esm/Chatbox/PureLoader.tsx +4 -2
- package/lib/esm/Chatbox/TypingEffect.tsx +12 -41
- package/lib/esm/Chatbox/index.scss +118 -28
- package/lib/esm/Chatbox/index.tsx +148 -36
- package/lib/esm/Chatbox/utils/func.ts +52 -1
- package/lib/esm/Textarea/index.tsx +0 -2
- package/lib/esm/Utils/libs/format-string.ts +106 -0
- package/package.json +1 -1
package/Chatbox/index.css
CHANGED
|
@@ -1,24 +1,19 @@
|
|
|
1
1
|
/*=================== Chatbox (Loading) =================*/
|
|
2
2
|
.custom-chatbox-loader-container {
|
|
3
|
+
--custom-chatbox-loader-color: #b9caf7;
|
|
4
|
+
--custom-chatbox-loader-color2: #0d6efd;
|
|
3
5
|
width: 130px;
|
|
4
6
|
text-align: start;
|
|
5
7
|
}
|
|
6
8
|
.custom-chatbox-loader-container .custom-chatbox-loader {
|
|
7
9
|
height: 4px;
|
|
8
10
|
width: 100%;
|
|
9
|
-
--c: no-repeat linear-gradient(var(--
|
|
10
|
-
background: var(--c), var(--c),
|
|
11
|
+
--c: no-repeat linear-gradient(var(--custom-chatbox-loader-color2) 0 0);
|
|
12
|
+
background: var(--c), var(--c), var(--custom-chatbox-loader-color);
|
|
11
13
|
background-size: 60% 100%;
|
|
12
|
-
animation:
|
|
14
|
+
animation: loader-move 3s infinite;
|
|
13
15
|
}
|
|
14
|
-
|
|
15
|
-
.dark-mode .custom-chatbox-loader-container .custom-chatbox-loader,
|
|
16
|
-
[data-bs-theme=dark] .custom-chatbox-loader-container .custom-chatbox-loader {
|
|
17
|
-
--c: no-repeat linear-gradient(var(--bs-primary) 0 0);
|
|
18
|
-
background: var(--c), var(--c), #8692b5;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
@keyframes cssAnim--loadermove {
|
|
16
|
+
@keyframes loader-move {
|
|
22
17
|
0% {
|
|
23
18
|
background-position: -150% 0, -150% 0;
|
|
24
19
|
}
|
|
@@ -29,6 +24,29 @@
|
|
|
29
24
|
background-position: 250% 0, 250% 0;
|
|
30
25
|
}
|
|
31
26
|
}
|
|
27
|
+
|
|
28
|
+
.custom-chatbox-mini-loader {
|
|
29
|
+
--custom-chatbox-miniloader-color: rgba(0,0,0,.5);
|
|
30
|
+
width: 15px;
|
|
31
|
+
height: 15px;
|
|
32
|
+
margin: 0.5rem;
|
|
33
|
+
margin-bottom: 0;
|
|
34
|
+
border: 3px dotted var(--custom-chatbox-miniloader-color);
|
|
35
|
+
border-radius: 50%;
|
|
36
|
+
display: inline-block;
|
|
37
|
+
position: relative;
|
|
38
|
+
box-sizing: border-box;
|
|
39
|
+
animation: mini-loader-spin 1s linear infinite;
|
|
40
|
+
}
|
|
41
|
+
@keyframes mini-loader-spin {
|
|
42
|
+
0% {
|
|
43
|
+
transform: rotate(0deg);
|
|
44
|
+
}
|
|
45
|
+
100% {
|
|
46
|
+
transform: rotate(360deg);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
32
50
|
/*=================== Chatbox (Core) =================*/
|
|
33
51
|
.custom-chatbox-circle {
|
|
34
52
|
--custom-chatbox-circle-color: #5A5EB9;
|
|
@@ -115,6 +133,8 @@
|
|
|
115
133
|
--custom-chatbox-toolkit-btn-radius: 20px;
|
|
116
134
|
--custom-chatbox-questions-bg: #f5f5f5;
|
|
117
135
|
--custom-chatbox-questions-hover-bg: #e9e9e9;
|
|
136
|
+
--custom-chatbox-content-html-elem-border-color: #ddd;
|
|
137
|
+
--custom-chatbox-content-html-elem-bg: rgba(0,0,0,.05);
|
|
118
138
|
min-width: var(--custom-chatbox-w);
|
|
119
139
|
max-width: var(--custom-chatbox-w);
|
|
120
140
|
margin: auto;
|
|
@@ -142,6 +162,8 @@
|
|
|
142
162
|
padding: 0;
|
|
143
163
|
font-size: 0.75rem;
|
|
144
164
|
margin-bottom: 0.5rem;
|
|
165
|
+
background: var(--custom-chatbox-msg-bg);
|
|
166
|
+
padding: 0.5rem;
|
|
145
167
|
}
|
|
146
168
|
.custom-chatbox-container summary {
|
|
147
169
|
cursor: pointer;
|
|
@@ -171,11 +193,12 @@
|
|
|
171
193
|
font-size: 0.75rem;
|
|
172
194
|
}
|
|
173
195
|
.custom-chatbox-container .messages {
|
|
174
|
-
height: calc(100% -
|
|
196
|
+
height: calc(100% - 110px);
|
|
175
197
|
overflow-y: auto;
|
|
176
198
|
margin-bottom: 10px;
|
|
177
199
|
font-size: 13px;
|
|
178
200
|
margin-right: 0;
|
|
201
|
+
/* copy button */
|
|
179
202
|
}
|
|
180
203
|
.custom-chatbox-container .messages img, .custom-chatbox-container .messages svg, .custom-chatbox-container .messages video, .custom-chatbox-container .messages canvas, .custom-chatbox-container .messages audio, .custom-chatbox-container .messages iframe, .custom-chatbox-container .messages embed, .custom-chatbox-container .messages object {
|
|
181
204
|
display: inline;
|
|
@@ -186,10 +209,11 @@
|
|
|
186
209
|
.custom-chatbox-container .messages::-webkit-scrollbar-thumb {
|
|
187
210
|
background: rgba(0, 0, 0, 0.2);
|
|
188
211
|
}
|
|
189
|
-
.custom-chatbox-container .messages > div {
|
|
212
|
+
.custom-chatbox-container .messages > div:not(.newchat-btn) {
|
|
190
213
|
margin: 5px 0;
|
|
191
214
|
padding: 3px 5px;
|
|
192
215
|
border-radius: 0.35rem;
|
|
216
|
+
position: relative;
|
|
193
217
|
}
|
|
194
218
|
.custom-chatbox-container .messages p {
|
|
195
219
|
margin: 3px 0;
|
|
@@ -216,6 +240,33 @@
|
|
|
216
240
|
margin-top: 0.3rem;
|
|
217
241
|
display: inline-block;
|
|
218
242
|
text-align: start;
|
|
243
|
+
/* Custom HTML Styles */
|
|
244
|
+
}
|
|
245
|
+
.custom-chatbox-container .messages .qa-content .table-container {
|
|
246
|
+
overflow-x: auto;
|
|
247
|
+
margin-bottom: 0.5rem;
|
|
248
|
+
}
|
|
249
|
+
.custom-chatbox-container .messages .qa-content .table-container::-webkit-scrollbar {
|
|
250
|
+
height: 10px;
|
|
251
|
+
}
|
|
252
|
+
.custom-chatbox-container .messages .qa-content .table-container::-webkit-scrollbar-thumb {
|
|
253
|
+
background: rgba(0, 0, 0, 0.2);
|
|
254
|
+
}
|
|
255
|
+
.custom-chatbox-container .messages .qa-content .table-container table {
|
|
256
|
+
width: 100%;
|
|
257
|
+
border-collapse: collapse;
|
|
258
|
+
border-radius: 0.35rem;
|
|
259
|
+
}
|
|
260
|
+
.custom-chatbox-container .messages .qa-content .table-container table thead {
|
|
261
|
+
background: var(--custom-chatbox-content-html-elem-bg);
|
|
262
|
+
}
|
|
263
|
+
.custom-chatbox-container .messages .qa-content .table-container table thead tr {
|
|
264
|
+
white-space: nowrap;
|
|
265
|
+
}
|
|
266
|
+
.custom-chatbox-container .messages .qa-content .table-container table th, .custom-chatbox-container .messages .qa-content .table-container table td {
|
|
267
|
+
padding: 0.25rem;
|
|
268
|
+
text-align: left;
|
|
269
|
+
border: 1px solid var(--custom-chatbox-content-html-elem-border-color);
|
|
219
270
|
}
|
|
220
271
|
.custom-chatbox-container .messages .request {
|
|
221
272
|
text-align: end;
|
|
@@ -232,6 +283,23 @@
|
|
|
232
283
|
}
|
|
233
284
|
.custom-chatbox-container .messages .reply .qa-content {
|
|
234
285
|
width: var(--custom-chatbox-content-w);
|
|
286
|
+
background: transparent;
|
|
287
|
+
padding-top: 0;
|
|
288
|
+
}
|
|
289
|
+
.custom-chatbox-container .messages .copy-btn {
|
|
290
|
+
position: absolute;
|
|
291
|
+
left: calc(var(--custom-chatbox-content-w) - 0.7rem);
|
|
292
|
+
bottom: 0.5rem;
|
|
293
|
+
z-index: 1;
|
|
294
|
+
background: transparent;
|
|
295
|
+
border: none;
|
|
296
|
+
padding: 4px;
|
|
297
|
+
cursor: pointer;
|
|
298
|
+
opacity: 0.6;
|
|
299
|
+
transition: opacity 0.2s;
|
|
300
|
+
}
|
|
301
|
+
.custom-chatbox-container .messages .copy-btn:hover {
|
|
302
|
+
opacity: 1;
|
|
235
303
|
}
|
|
236
304
|
.custom-chatbox-container .msg-dotted-loader-container {
|
|
237
305
|
font-weight: normal;
|
|
@@ -373,6 +441,11 @@
|
|
|
373
441
|
}
|
|
374
442
|
.custom-chatbox-container .newchat-btn {
|
|
375
443
|
text-align: center;
|
|
444
|
+
position: absolute;
|
|
445
|
+
bottom: 95px;
|
|
446
|
+
left: 50%;
|
|
447
|
+
transform: translateX(-50%);
|
|
448
|
+
z-index: 1;
|
|
376
449
|
}
|
|
377
450
|
.custom-chatbox-container .newchat-btn > button {
|
|
378
451
|
padding: 3px 6px;
|
|
@@ -462,6 +535,7 @@
|
|
|
462
535
|
box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
|
|
463
536
|
margin-bottom: 10px;
|
|
464
537
|
max-height: 300px;
|
|
538
|
+
min-width: 120px;
|
|
465
539
|
overflow-y: auto;
|
|
466
540
|
animation: dropupAnimation 0.2s ease;
|
|
467
541
|
position: absolute;
|
|
@@ -489,7 +563,7 @@
|
|
|
489
563
|
.custom-chatbox-container .toolkit-select-wrapper .toolkit-select-option.cancel {
|
|
490
564
|
color: var(--custom-chatbox-gray-color);
|
|
491
565
|
}
|
|
492
|
-
.custom-chatbox-container .toolkit-select-wrapper .toolkit-select-option:hover {
|
|
566
|
+
.custom-chatbox-container .toolkit-select-wrapper .toolkit-select-option.selected:not(.cancel), .custom-chatbox-container .toolkit-select-wrapper .toolkit-select-option:hover {
|
|
493
567
|
background-color: var(--custom-chatbox-toolkit-opt-active-color);
|
|
494
568
|
}
|
|
495
569
|
.custom-chatbox-container .default-questions-title {
|
package/Chatbox/index.d.ts
CHANGED
|
@@ -18,6 +18,7 @@ export interface FloatingButton {
|
|
|
18
18
|
value: string;
|
|
19
19
|
onClick: string;
|
|
20
20
|
isSelect?: boolean;
|
|
21
|
+
dynamicOptions?: boolean;
|
|
21
22
|
[key: string]: any;
|
|
22
23
|
}
|
|
23
24
|
export interface FloatingButtonSelectOption {
|
|
@@ -71,10 +72,14 @@ export declare type ChatboxProps = {
|
|
|
71
72
|
newChatButton?: FloatingButton;
|
|
72
73
|
customMethods?: CustomMethod[];
|
|
73
74
|
defaultQuestions?: QuestionData;
|
|
75
|
+
showCopyBtn?: boolean;
|
|
76
|
+
autoCopyReply?: boolean;
|
|
74
77
|
customRequest?: CustomRequestFunction;
|
|
75
78
|
renderParser?: (input: string) => Promise<string>;
|
|
76
79
|
requestBodyFormatter?: (body: any, contextData: Record<string, any>, conversationHistory: MessageDetail[]) => Promise<Record<string, any>>;
|
|
80
|
+
copiedContentFormatter?: (string: string) => string;
|
|
77
81
|
nameFormatter?: (input: string) => string;
|
|
82
|
+
onCopyCallback?: (res: Record<string, any>) => void;
|
|
78
83
|
onQuestionClick?: (text: string, methods: Record<string, Function>) => void;
|
|
79
84
|
onInputChange?: (controlRef: React.RefObject<any>, val: string) => any;
|
|
80
85
|
onInputCallback?: (input: string) => Promise<string>;
|