funda-ui 4.7.770 → 4.7.810

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 (42) hide show
  1. package/Chatbox/index.css +62 -0
  2. package/Chatbox/index.d.ts +36 -0
  3. package/Chatbox/index.js +1543 -195
  4. package/DigitalClock/index.js +1 -1
  5. package/LiveSearch/index.js +51 -122
  6. package/MultipleCheckboxes/index.js +51 -122
  7. package/MultipleSelect/index.js +51 -122
  8. package/NativeSelect/index.js +51 -122
  9. package/Radio/index.js +51 -122
  10. package/Select/index.js +51 -122
  11. package/Tooltip/index.js +2 -2
  12. package/Utils/anim.js +46 -121
  13. package/Utils/buffer.d.ts +1 -1
  14. package/Utils/initDefaultOptions.js +46 -121
  15. package/Utils/useInterval.js +1 -1
  16. package/Utils/validate.d.ts +10 -37
  17. package/Utils/validate.js +46 -120
  18. package/lib/cjs/Chatbox/index.d.ts +36 -0
  19. package/lib/cjs/Chatbox/index.js +1543 -195
  20. package/lib/cjs/DigitalClock/index.js +1 -1
  21. package/lib/cjs/LiveSearch/index.js +51 -122
  22. package/lib/cjs/MultipleCheckboxes/index.js +51 -122
  23. package/lib/cjs/MultipleSelect/index.js +51 -122
  24. package/lib/cjs/NativeSelect/index.js +51 -122
  25. package/lib/cjs/Radio/index.js +51 -122
  26. package/lib/cjs/Select/index.js +51 -122
  27. package/lib/cjs/Tooltip/index.js +2 -2
  28. package/lib/cjs/Utils/anim.js +46 -121
  29. package/lib/cjs/Utils/buffer.d.ts +1 -1
  30. package/lib/cjs/Utils/initDefaultOptions.js +46 -121
  31. package/lib/cjs/Utils/useInterval.js +1 -1
  32. package/lib/cjs/Utils/validate.d.ts +10 -37
  33. package/lib/cjs/Utils/validate.js +46 -120
  34. package/lib/css/Chatbox/index.css +62 -0
  35. package/lib/esm/Chatbox/helpers.tsx +78 -0
  36. package/lib/esm/Chatbox/index.scss +85 -1
  37. package/lib/esm/Chatbox/index.tsx +532 -38
  38. package/lib/esm/Tooltip/index.tsx +5 -5
  39. package/lib/esm/Utils/hooks/useInterval.tsx +2 -2
  40. package/lib/esm/Utils/libs/buffer.ts +2 -2
  41. package/lib/esm/Utils/libs/validate.ts +62 -106
  42. package/package.json +1 -1
package/Chatbox/index.css CHANGED
@@ -135,6 +135,7 @@
135
135
  --custom-chatbox-questions-hover-bg: #e9e9e9;
136
136
  --custom-chatbox-content-html-elem-border-color: #ddd;
137
137
  --custom-chatbox-content-html-elem-bg: rgba(0,0,0,.05);
138
+ --custom-chatbox-voice-input-color: #ff4444;
138
139
  --custom-balloon-border-radius: 0.35rem;
139
140
  --custom-balloon-color: rgba(16, 16, 16, 0.95);
140
141
  --custom-balloon-text-color: #fff;
@@ -455,6 +456,67 @@
455
456
  background-color: var(--custom-chatbox-stop-color);
456
457
  border-color: var(--custom-chatbox-stop-color);
457
458
  }
459
+ .custom-chatbox-container .msgcontrol [class*=chatbox-voice-input-btn] {
460
+ border: none;
461
+ right: 3.2rem;
462
+ background: none;
463
+ width: 40px;
464
+ height: 40px;
465
+ z-index: 4;
466
+ }
467
+ .custom-chatbox-container .msgcontrol [class*=chatbox-voice-input-btn] svg path {
468
+ fill: var(--custom-chatbox-primary-text);
469
+ }
470
+ .custom-chatbox-container .msgcontrol [class*=chatbox-voice-input-btn-wrapper].active > span {
471
+ border-radius: 50%;
472
+ margin-left: 0.5rem;
473
+ z-index: 3;
474
+ right: calc(40px + 0.4rem + 0.3rem);
475
+ bottom: 0.3rem;
476
+ position: absolute;
477
+ background-color: var(--custom-chatbox-primary-color);
478
+ width: 40px;
479
+ height: 40px;
480
+ display: block;
481
+ pointer-events: none;
482
+ background-color: var(--custom-chatbox-voice-input-color);
483
+ border-color: var(--custom-chatbox-voice-input-color);
484
+ animation: pulse 1.5s ease-in-out infinite;
485
+ }
486
+ .custom-chatbox-container .msgcontrol [class*=chatbox-voice-input-btn-wrapper].active > span::after {
487
+ content: "";
488
+ position: absolute;
489
+ top: 0;
490
+ left: 0;
491
+ right: 0;
492
+ bottom: 0;
493
+ border-radius: 50%;
494
+ border: 3px solid var(--custom-chatbox-voice-input-color);
495
+ animation: ripple 1.5s cubic-bezier(0.24, 0, 0.38, 1) infinite;
496
+ }
497
+ .custom-chatbox-container .msgcontrol [class*=chatbox-voice-input-btn-wrapper].active > button svg path {
498
+ fill: var(--custom-chatbox-msg-bg);
499
+ }
500
+ @keyframes pulse {
501
+ 0%, 100% {
502
+ opacity: 1;
503
+ transform: scale(1);
504
+ }
505
+ 50% {
506
+ opacity: 0.8;
507
+ transform: scale(1.05);
508
+ }
509
+ }
510
+ @keyframes ripple {
511
+ 0% {
512
+ transform: scale(1);
513
+ opacity: 0.8;
514
+ }
515
+ 100% {
516
+ transform: scale(1.4);
517
+ opacity: 0;
518
+ }
519
+ }
458
520
  .custom-chatbox-container .loading {
459
521
  margin-top: 0;
460
522
  height: 5px;
@@ -48,6 +48,41 @@ export declare type CustomRequestResponse = {
48
48
  isStream: boolean;
49
49
  };
50
50
  export declare type CustomRequestFunction = (message: string, config: CustomRequestConfig, customMethods: CustomMethod[], conversationHistory: MessageDetail[]) => Promise<CustomRequestResponse>;
51
+ export declare type VoiceConfig = {
52
+ enableVoiceInput: boolean;
53
+ holdToTalk?: boolean;
54
+ voiceInputAppId?: string;
55
+ voiceInputApiKey?: string;
56
+ voiceInputApiSecret?: string;
57
+ voiceInputSampleRate?: number;
58
+ voiceInputFormat?: string;
59
+ voiceInputEncoding?: string;
60
+ voiceInputHost?: string;
61
+ voiceInputPath?: string;
62
+ voiceInputProtocol?: string;
63
+ voiceInputHmacAlgorithm?: string;
64
+ voiceInputHashAlgorithm?: string;
65
+ voiceInputUrlTemplate?: string;
66
+ voiceInputRequestBodyTemplate?: string;
67
+ voiceInputAudioBodyTemplate?: string;
68
+ voiceInputUuid?: string;
69
+ voiceInputLang?: string;
70
+ voiceInputUtc?: string;
71
+ voiceResponseExtractor?: string;
72
+ voiceInputIdleTimeoutSeconds?: number;
73
+ voiceInputEndTimeoutSeconds?: number;
74
+ generateVoiceSignature?: (params: {
75
+ host: string;
76
+ path: string;
77
+ date: string;
78
+ apiKey: string;
79
+ apiSecret: string;
80
+ }) => string | Promise<string>;
81
+ onVoiceInputStart?: () => void;
82
+ onVoiceInputEnd?: (text: string) => void;
83
+ onVoiceInputError?: (error: Error) => void;
84
+ onVoiceInputInterrupt?: () => void;
85
+ };
51
86
  export declare type ChatboxProps = {
52
87
  debug?: boolean;
53
88
  defaultRows?: number;
@@ -96,6 +131,7 @@ export declare type ChatboxProps = {
96
131
  onInputCallback?: (input: string) => Promise<string>;
97
132
  onChunk?: (controlRef: React.RefObject<any>, lastContent: string, conversationHistory: MessageDetail[]) => any;
98
133
  onComplete?: (controlRef: React.RefObject<any>, lastContent: string, conversationHistory: MessageDetail[]) => any;
134
+ voiceConfig?: VoiceConfig;
99
135
  };
100
136
  declare const Chatbox: (props: ChatboxProps) => JSX.Element;
101
137
  export default Chatbox;