@elicecontents/content-ui 1.0.10 → 1.0.11-rc.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.
- package/cjs/components/chat/Chat.d.ts +11 -9
- package/cjs/components/chat/Chat.js +207 -166
- package/cjs/components/index.d.ts +2 -0
- package/cjs/components/index.js +6 -0
- package/cjs/components/layout/Layout.js +2 -2
- package/cjs/components/recorder/Recorder.js +11 -5
- package/cjs/components/recorder-step/RecorderContext.d.ts +40 -0
- package/cjs/components/recorder-step/RecorderContext.js +197 -0
- package/cjs/components/recorder-step/RecorderStep.d.ts +16 -0
- package/cjs/components/recorder-step/RecorderStep.js +248 -0
- package/cjs/components/recorder-step/index.d.ts +3 -0
- package/cjs/components/recorder-step/index.js +9 -0
- package/cjs/components/sound-visualizer/SoundVisualizer.d.ts +11 -0
- package/cjs/components/sound-visualizer/SoundVisualizer.js +117 -0
- package/cjs/components/sound-visualizer/index.d.ts +3 -0
- package/cjs/components/sound-visualizer/index.js +7 -0
- package/cjs/index.js +6 -0
- package/cjs/theme/createAIDTTheme.d.ts +41 -3
- package/cjs/theme/createAIDTTheme.js +1 -4
- package/cjs/tokens/colors/common.d.ts +0 -7
- package/cjs/tokens/colors/common.js +39 -8
- package/es/components/chat/Chat.d.ts +11 -9
- package/es/components/chat/Chat.js +209 -168
- package/es/components/index.d.ts +2 -0
- package/es/components/index.js +3 -0
- package/es/components/layout/Layout.js +2 -2
- package/es/components/recorder/Recorder.js +11 -5
- package/es/components/recorder-step/RecorderContext.d.ts +40 -0
- package/es/components/recorder-step/RecorderContext.js +194 -0
- package/es/components/recorder-step/RecorderStep.d.ts +16 -0
- package/es/components/recorder-step/RecorderStep.js +239 -0
- package/es/components/recorder-step/index.d.ts +3 -0
- package/es/components/recorder-step/index.js +2 -0
- package/es/components/sound-visualizer/SoundVisualizer.d.ts +11 -0
- package/es/components/sound-visualizer/SoundVisualizer.js +108 -0
- package/es/components/sound-visualizer/index.d.ts +3 -0
- package/es/components/sound-visualizer/index.js +1 -0
- package/es/index.js +3 -0
- package/es/theme/createAIDTTheme.d.ts +41 -3
- package/es/theme/createAIDTTheme.js +1 -4
- package/es/tokens/colors/common.d.ts +0 -7
- package/es/tokens/colors/common.js +39 -8
- package/package.json +1 -1
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
+
import type { RecorderType } from "../recorder-step/RecorderStep";
|
|
2
3
|
export type EliceMessageItem = {
|
|
3
4
|
role: "system" | "user" | "assistant";
|
|
4
5
|
content: string;
|
|
@@ -19,10 +20,13 @@ export interface EliceChatProps {
|
|
|
19
20
|
isDisabled?: boolean;
|
|
20
21
|
backgroundImage?: string;
|
|
21
22
|
CustomAssistantAvatar?: React.ReactNode;
|
|
23
|
+
type?: string;
|
|
24
|
+
recorderType?: RecorderType;
|
|
25
|
+
isOnlyRecord: boolean;
|
|
22
26
|
}
|
|
23
27
|
declare const EliceChat: {
|
|
24
|
-
(
|
|
25
|
-
MessageList({ messages, isLoadingMessage, scrollRef, height,
|
|
28
|
+
(props: React.ComponentProps<typeof EliceChatContainer>): import("react/jsx-runtime").JSX.Element;
|
|
29
|
+
MessageList({ messages, isLoadingMessage, scrollRef, height, CustomAssistantAvatar, }: {
|
|
26
30
|
messages: {
|
|
27
31
|
role: "system" | "user" | "assistant";
|
|
28
32
|
content: string;
|
|
@@ -30,11 +34,9 @@ declare const EliceChat: {
|
|
|
30
34
|
isLoadingMessage?: boolean | undefined;
|
|
31
35
|
scrollRef: React.RefObject<HTMLDivElement>;
|
|
32
36
|
height?: string | undefined;
|
|
33
|
-
isRecord: boolean;
|
|
34
|
-
setIsRecord?: (() => void) | undefined;
|
|
35
37
|
CustomAssistantAvatar: React.ReactNode;
|
|
36
38
|
}): import("react/jsx-runtime").JSX.Element;
|
|
37
|
-
InputArea({ placeHolder, value, isDisabled, onChange, onSend, onReset, onRecord, onTranscribingChange,
|
|
39
|
+
InputArea({ placeHolder, value, isDisabled, onChange, onSend, onReset, onRecord, onTranscribingChange, isOnlyRecord, }: {
|
|
38
40
|
placeHolder: string;
|
|
39
41
|
value: string;
|
|
40
42
|
isDisabled: boolean;
|
|
@@ -42,12 +44,12 @@ declare const EliceChat: {
|
|
|
42
44
|
onSend: () => void;
|
|
43
45
|
onReset: () => void;
|
|
44
46
|
onRecord?: (() => void) | undefined;
|
|
45
|
-
isRecord: boolean;
|
|
46
|
-
setIsRecord?: (() => void) | undefined;
|
|
47
47
|
onTransform?: (() => void) | undefined;
|
|
48
|
-
setAudioFile?: ((file: File
|
|
48
|
+
setAudioFile?: ((file: File) => void) | undefined;
|
|
49
49
|
onTranscribingChange?: ((value: boolean) => void) | undefined;
|
|
50
|
+
type: RecorderType;
|
|
51
|
+
isOnlyRecord: boolean;
|
|
50
52
|
}): import("react/jsx-runtime").JSX.Element;
|
|
51
53
|
};
|
|
52
|
-
|
|
54
|
+
declare const EliceChatContainer: ({ placeholder, messages, content, onReset, onSend, onChange, onRecord, onTranscribingChange, setAudioFile, onTransform, isLoadingMessage, CustomAssistantAvatar, isDisabled, backgroundImage, height, recorderType, isOnlyRecord }: EliceChatProps) => import("react/jsx-runtime").JSX.Element;
|
|
53
55
|
export default EliceChat;
|
|
@@ -10,142 +10,60 @@ var material = require('@mui/material');
|
|
|
10
10
|
require('tslib');
|
|
11
11
|
var Micro = require('../../icons/Micro.js');
|
|
12
12
|
var Reset = require('../../icons/Reset.js');
|
|
13
|
+
var ReadyRecord = require('../../icons/ReadyRecord.js');
|
|
13
14
|
var SendArrow = require('../../icons/SendArrow.js');
|
|
14
15
|
var IconButton = require('../icon-button/IconButton.js');
|
|
16
|
+
var RecorderContext = require('../recorder-step/RecorderContext.js');
|
|
15
17
|
var AIAvatar = require('../../assets/AIAvatar.png.js');
|
|
16
18
|
var AssistantAvatar = require('./AssistantAvatar.js');
|
|
17
19
|
var UserAvatar = require('./UserAvatar.js');
|
|
18
20
|
var TypingIndicator = require('./TypingIndicator.js');
|
|
19
|
-
var
|
|
21
|
+
var RecorderStep = require('../recorder-step/RecorderStep.js');
|
|
20
22
|
|
|
21
23
|
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
|
|
22
24
|
|
|
23
25
|
var _styled__default = /*#__PURE__*/_interopDefaultCompat(_styled);
|
|
24
26
|
|
|
25
27
|
function _EMOTION_STRINGIFIED_CSS_ERROR__() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
|
|
26
|
-
var
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
var
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
var theme = _ref8.theme;
|
|
57
|
-
return theme.palette.grey[300];
|
|
58
|
-
}, ";}::before{border:none;}:hover{::before{border:none;}}::after{border-bottom:none!important;}::-webkit-scrollbar{width:0.25rem;}::-webkit-scrollbar-track{background:", function (_ref9) {
|
|
59
|
-
var theme = _ref9.theme;
|
|
60
|
-
return theme.palette.grey[200];
|
|
61
|
-
}, ";border-radius:0.5rem;}::-webkit-scrollbar-thumb{background:", function (_ref10) {
|
|
62
|
-
var theme = _ref10.theme;
|
|
63
|
-
return theme.palette.primary.main;
|
|
64
|
-
}, ";border-radius:0.5rem;}::-webkit-scrollbar-thumb:hover{background:", function (_ref11) {
|
|
65
|
-
var theme = _ref11.theme;
|
|
66
|
-
return theme.palette.secondary.main;
|
|
67
|
-
}, ";}");
|
|
68
|
-
var StyledMessage = /*#__PURE__*/_styled__default.default(material.Typography, {
|
|
69
|
-
target: "e1i7zt3"
|
|
70
|
-
})("color:", function (_ref12) {
|
|
71
|
-
var isAssistant = _ref12.isAssistant,
|
|
72
|
-
theme = _ref12.theme;
|
|
73
|
-
return isAssistant ? theme.palette.text.secondary : theme.palette.secondary.main;
|
|
74
|
-
}, ";font-size:1rem;font-weight:", function (_ref13) {
|
|
75
|
-
var isAssistant = _ref13.isAssistant;
|
|
76
|
-
return isAssistant ? 500 : 700;
|
|
77
|
-
}, ";background-color:", function (_ref14) {
|
|
78
|
-
var isAssistant = _ref14.isAssistant,
|
|
79
|
-
theme = _ref14.theme;
|
|
80
|
-
return isAssistant ? theme.palette.grey[50] : theme.palette.primary.light;
|
|
81
|
-
}, ";border-radius:1rem;white-space:pre-wrap;padding:0.75rem;margin-bottom:16px;");
|
|
82
|
-
var RecordingOverlay = /*#__PURE__*/_styled__default.default("div", {
|
|
83
|
-
target: "e1i7zt2"
|
|
84
|
-
})("production" === "production" ? {
|
|
85
|
-
name: "1805g3a",
|
|
86
|
-
styles: "position:absolute;top:0;left:24px;width:calc(100% - 48px);height:calc(100% - 24px);background-color:rgba(0, 0, 0, 0.4);z-index:999;backdrop-filter:blur(1px);border-radius:0 0 1.125rem 1.125rem"
|
|
87
|
-
} : {
|
|
88
|
-
name: "1805g3a",
|
|
89
|
-
styles: "position:absolute;top:0;left:24px;width:calc(100% - 48px);height:calc(100% - 24px);background-color:rgba(0, 0, 0, 0.4);z-index:999;backdrop-filter:blur(1px);border-radius:0 0 1.125rem 1.125rem",
|
|
90
|
-
toString: _EMOTION_STRINGIFIED_CSS_ERROR__
|
|
91
|
-
});
|
|
92
|
-
var EmptyMessageContainer = /*#__PURE__*/_styled__default.default(material.Stack, {
|
|
93
|
-
target: "e1i7zt1"
|
|
94
|
-
})("production" === "production" ? {
|
|
95
|
-
name: "1bdo6l4",
|
|
96
|
-
styles: "display:flex;justify-content:center;align-items:center;height:100%;gap:1rem"
|
|
97
|
-
} : {
|
|
98
|
-
name: "1bdo6l4",
|
|
99
|
-
styles: "display:flex;justify-content:center;align-items:center;height:100%;gap:1rem",
|
|
100
|
-
toString: _EMOTION_STRINGIFIED_CSS_ERROR__
|
|
101
|
-
});
|
|
102
|
-
var AIAvatarImage = /*#__PURE__*/_styled__default.default("img", {
|
|
103
|
-
target: "e1i7zt0"
|
|
104
|
-
})("production" === "production" ? {
|
|
105
|
-
name: "1l4h0oe",
|
|
106
|
-
styles: "width:120px;height:120px;flex-shrink:0"
|
|
107
|
-
} : {
|
|
108
|
-
name: "1l4h0oe",
|
|
109
|
-
styles: "width:120px;height:120px;flex-shrink:0",
|
|
110
|
-
toString: _EMOTION_STRINGIFIED_CSS_ERROR__
|
|
111
|
-
});
|
|
112
|
-
var _EliceChat = function EliceChat(_ref15) {
|
|
113
|
-
var _ref15$placeholder = _ref15.placeholder,
|
|
114
|
-
placeholder = _ref15$placeholder === void 0 ? "AI와 대화를 시작해 보세요" : _ref15$placeholder,
|
|
115
|
-
_ref15$messages = _ref15.messages,
|
|
116
|
-
messages = _ref15$messages === void 0 ? [] : _ref15$messages,
|
|
117
|
-
_ref15$content = _ref15.content,
|
|
118
|
-
content = _ref15$content === void 0 ? "" : _ref15$content,
|
|
119
|
-
onReset = _ref15.onReset,
|
|
120
|
-
onSend = _ref15.onSend,
|
|
121
|
-
_onChange = _ref15.onChange,
|
|
122
|
-
onRecord = _ref15.onRecord,
|
|
123
|
-
onTranscribingChange = _ref15.onTranscribingChange,
|
|
124
|
-
setAudioFile = _ref15.setAudioFile,
|
|
125
|
-
onTransform = _ref15.onTransform,
|
|
126
|
-
isLoadingMessage = _ref15.isLoadingMessage,
|
|
127
|
-
CustomAssistantAvatar = _ref15.CustomAssistantAvatar,
|
|
128
|
-
_ref15$isDisabled = _ref15.isDisabled,
|
|
129
|
-
isDisabled = _ref15$isDisabled === void 0 ? false : _ref15$isDisabled,
|
|
130
|
-
backgroundImage = _ref15.backgroundImage,
|
|
131
|
-
_ref15$height = _ref15.height,
|
|
132
|
-
height = _ref15$height === void 0 ? "100%" : _ref15$height;
|
|
28
|
+
var EliceChat = function EliceChat(props) {
|
|
29
|
+
return jsxRuntime.jsx(RecorderContext.RecorderProvider, {
|
|
30
|
+
children: jsxRuntime.jsx(EliceChatContainer, Object.assign({}, props))
|
|
31
|
+
});
|
|
32
|
+
};
|
|
33
|
+
var EliceChatContainer = function EliceChatContainer(_ref) {
|
|
34
|
+
var _ref$placeholder = _ref.placeholder,
|
|
35
|
+
placeholder = _ref$placeholder === void 0 ? "AI와 대화를 시작해 보세요" : _ref$placeholder,
|
|
36
|
+
_ref$messages = _ref.messages,
|
|
37
|
+
messages = _ref$messages === void 0 ? [] : _ref$messages,
|
|
38
|
+
_ref$content = _ref.content,
|
|
39
|
+
content = _ref$content === void 0 ? "" : _ref$content,
|
|
40
|
+
onReset = _ref.onReset,
|
|
41
|
+
onSend = _ref.onSend,
|
|
42
|
+
_onChange = _ref.onChange,
|
|
43
|
+
onRecord = _ref.onRecord,
|
|
44
|
+
onTranscribingChange = _ref.onTranscribingChange,
|
|
45
|
+
setAudioFile = _ref.setAudioFile,
|
|
46
|
+
onTransform = _ref.onTransform,
|
|
47
|
+
isLoadingMessage = _ref.isLoadingMessage,
|
|
48
|
+
CustomAssistantAvatar = _ref.CustomAssistantAvatar,
|
|
49
|
+
_ref$isDisabled = _ref.isDisabled,
|
|
50
|
+
isDisabled = _ref$isDisabled === void 0 ? false : _ref$isDisabled,
|
|
51
|
+
backgroundImage = _ref.backgroundImage,
|
|
52
|
+
_ref$height = _ref.height,
|
|
53
|
+
height = _ref$height === void 0 ? "100%" : _ref$height,
|
|
54
|
+
_ref$recorderType = _ref.recorderType,
|
|
55
|
+
recorderType = _ref$recorderType === void 0 ? 'notNeed' : _ref$recorderType,
|
|
56
|
+
_ref$isOnlyRecord = _ref.isOnlyRecord,
|
|
57
|
+
isOnlyRecord = _ref$isOnlyRecord === void 0 ? false : _ref$isOnlyRecord;
|
|
133
58
|
var theme = material.useTheme();
|
|
134
59
|
var _useState = React.useState(content),
|
|
135
60
|
_useState2 = _rollupPluginBabelHelpers.slicedToArray(_useState, 2),
|
|
136
61
|
inputValue = _useState2[0],
|
|
137
62
|
setInputValue = _useState2[1];
|
|
138
63
|
var scrollRef = React.useRef(null);
|
|
139
|
-
var
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
setIsRecord = _useState4[1];
|
|
143
|
-
var onClickRecordButton = function onClickRecordButton() {
|
|
144
|
-
setIsRecord(true);
|
|
145
|
-
};
|
|
146
|
-
var onClickRecordOverlay = function onClickRecordOverlay() {
|
|
147
|
-
setIsRecord(false);
|
|
148
|
-
};
|
|
64
|
+
var _useRecorder = RecorderContext.useRecorder(),
|
|
65
|
+
recorderState = _useRecorder.state,
|
|
66
|
+
setIsRecording = _useRecorder.setIsRecording;
|
|
149
67
|
React.useEffect(function () {
|
|
150
68
|
if (scrollRef.current) {
|
|
151
69
|
scrollRef.current.scrollIntoView({
|
|
@@ -154,9 +72,11 @@ var _EliceChat = function EliceChat(_ref15) {
|
|
|
154
72
|
}
|
|
155
73
|
}, [messages, isLoadingMessage]);
|
|
156
74
|
var onClickRecordSubmit = function onClickRecordSubmit() {
|
|
157
|
-
setIsRecord(false);
|
|
158
75
|
onTransform === null || onTransform === void 0 ? void 0 : onTransform();
|
|
159
76
|
};
|
|
77
|
+
var onClickCloseIsRecording = function onClickCloseIsRecording() {
|
|
78
|
+
setIsRecording(false);
|
|
79
|
+
};
|
|
160
80
|
var handleSend = function handleSend() {
|
|
161
81
|
if (inputValue.trim()) {
|
|
162
82
|
onSend(inputValue);
|
|
@@ -167,49 +87,60 @@ var _EliceChat = function EliceChat(_ref15) {
|
|
|
167
87
|
theme: theme,
|
|
168
88
|
height: height,
|
|
169
89
|
backgroundImage: backgroundImage,
|
|
170
|
-
children: [jsxRuntime.jsx(
|
|
90
|
+
children: [recorderState.isRecording && setAudioFile && jsxRuntime.jsx(RecordingOverlay, {
|
|
91
|
+
onClick: onClickCloseIsRecording,
|
|
92
|
+
children: jsxRuntime.jsx(OverlayContent, {
|
|
93
|
+
onClick: function onClick(e) {
|
|
94
|
+
return e.stopPropagation();
|
|
95
|
+
},
|
|
96
|
+
children: jsxRuntime.jsx(RecorderStep.default, {
|
|
97
|
+
closeRecorder: onClickCloseIsRecording,
|
|
98
|
+
onAudioReady: setAudioFile,
|
|
99
|
+
onRecord: onRecord,
|
|
100
|
+
onTransform: onTransform,
|
|
101
|
+
type: recorderType,
|
|
102
|
+
visualType: "bar",
|
|
103
|
+
onTranscribingChange: onTranscribingChange,
|
|
104
|
+
isLoadingMessage: isLoadingMessage
|
|
105
|
+
})
|
|
106
|
+
})
|
|
107
|
+
}), jsxRuntime.jsx(EliceChat.MessageList, {
|
|
171
108
|
messages: messages,
|
|
172
109
|
isLoadingMessage: isLoadingMessage,
|
|
173
110
|
scrollRef: scrollRef,
|
|
174
|
-
setIsRecord: onClickRecordOverlay,
|
|
175
|
-
isRecord: isRecord,
|
|
176
111
|
CustomAssistantAvatar: CustomAssistantAvatar
|
|
177
|
-
}), jsxRuntime.jsx(
|
|
112
|
+
}), jsxRuntime.jsx(EliceChat.InputArea, {
|
|
178
113
|
placeHolder: placeholder,
|
|
179
114
|
value: inputValue,
|
|
180
115
|
onChange: function onChange(e) {
|
|
181
116
|
setInputValue(e.target.value);
|
|
182
117
|
_onChange(e.target.value);
|
|
183
118
|
},
|
|
184
|
-
|
|
185
|
-
isRecord: isRecord,
|
|
119
|
+
isOnlyRecord: isOnlyRecord,
|
|
186
120
|
setAudioFile: setAudioFile,
|
|
187
121
|
onTransform: onClickRecordSubmit,
|
|
188
122
|
onSend: handleSend,
|
|
189
123
|
onReset: onReset,
|
|
190
124
|
onRecord: onRecord,
|
|
191
125
|
onTranscribingChange: onTranscribingChange,
|
|
192
|
-
isDisabled: isDisabled
|
|
126
|
+
isDisabled: isDisabled,
|
|
127
|
+
type: recorderType
|
|
193
128
|
})]
|
|
194
129
|
});
|
|
195
130
|
};
|
|
196
131
|
// ✅ 메시지 리스트 컴포넌트
|
|
197
|
-
|
|
198
|
-
var messages =
|
|
199
|
-
isLoadingMessage =
|
|
200
|
-
scrollRef =
|
|
201
|
-
|
|
202
|
-
height =
|
|
203
|
-
|
|
204
|
-
setIsRecord = _ref16.setIsRecord,
|
|
205
|
-
CustomAssistantAvatar = _ref16.CustomAssistantAvatar;
|
|
132
|
+
EliceChat.MessageList = function (_ref2) {
|
|
133
|
+
var messages = _ref2.messages,
|
|
134
|
+
isLoadingMessage = _ref2.isLoadingMessage,
|
|
135
|
+
scrollRef = _ref2.scrollRef,
|
|
136
|
+
_ref2$height = _ref2.height,
|
|
137
|
+
height = _ref2$height === void 0 ? "100%" : _ref2$height,
|
|
138
|
+
CustomAssistantAvatar = _ref2.CustomAssistantAvatar;
|
|
206
139
|
var theme = material.useTheme();
|
|
207
|
-
return jsxRuntime.
|
|
140
|
+
return jsxRuntime.jsx(StyledScrollBarStack, {
|
|
208
141
|
theme: theme,
|
|
209
142
|
height: height,
|
|
210
|
-
children:
|
|
211
|
-
onClick: setIsRecord
|
|
212
|
-
}), messages.length === 0 ? jsxRuntime.jsxs(EmptyMessageContainer, {
|
|
143
|
+
children: messages.length === 0 ? jsxRuntime.jsxs(EmptyMessageContainer, {
|
|
213
144
|
children: [jsxRuntime.jsx(AIAvatarImage, {
|
|
214
145
|
src: AIAvatar.default,
|
|
215
146
|
alt: "Ai-avatar"
|
|
@@ -238,42 +169,41 @@ _EliceChat.MessageList = function (_ref16) {
|
|
|
238
169
|
}), isLoadingMessage && jsxRuntime.jsx(TypingIndicator.default, {}), jsxRuntime.jsx("div", {
|
|
239
170
|
ref: scrollRef
|
|
240
171
|
})]
|
|
241
|
-
})
|
|
172
|
+
})
|
|
242
173
|
});
|
|
243
174
|
};
|
|
244
|
-
|
|
245
|
-
var placeHolder =
|
|
246
|
-
value =
|
|
247
|
-
isDisabled =
|
|
248
|
-
onChange =
|
|
249
|
-
onSend =
|
|
250
|
-
onReset =
|
|
251
|
-
onRecord =
|
|
252
|
-
onTranscribingChange =
|
|
253
|
-
|
|
254
|
-
onTransform = _ref17.onTransform,
|
|
255
|
-
setIsRecord = _ref17.setIsRecord,
|
|
256
|
-
isRecord = _ref17.isRecord;
|
|
257
|
-
var _a;
|
|
175
|
+
EliceChat.InputArea = function (_ref3) {
|
|
176
|
+
var placeHolder = _ref3.placeHolder,
|
|
177
|
+
value = _ref3.value,
|
|
178
|
+
isDisabled = _ref3.isDisabled,
|
|
179
|
+
onChange = _ref3.onChange,
|
|
180
|
+
onSend = _ref3.onSend,
|
|
181
|
+
onReset = _ref3.onReset,
|
|
182
|
+
onRecord = _ref3.onRecord,
|
|
183
|
+
onTranscribingChange = _ref3.onTranscribingChange,
|
|
184
|
+
isOnlyRecord = _ref3.isOnlyRecord;
|
|
258
185
|
var theme = material.useTheme();
|
|
186
|
+
var _useRecorder2 = RecorderContext.useRecorder(),
|
|
187
|
+
recorderState = _useRecorder2.state,
|
|
188
|
+
setIsRecording = _useRecorder2.setIsRecording;
|
|
259
189
|
return jsxRuntime.jsx(material.Stack, {
|
|
260
190
|
direction: "row",
|
|
261
191
|
minHeight: "3.875rem",
|
|
192
|
+
display: recorderState.isRecording ? "none" : "",
|
|
262
193
|
bgcolor: theme.palette.grey[50],
|
|
263
194
|
borderRadius: "1.125rem",
|
|
264
|
-
width:
|
|
265
|
-
justifyContent:
|
|
266
|
-
alignItems:
|
|
195
|
+
width: recorderState.isRecording ? "100%" : "auto",
|
|
196
|
+
justifyContent: recorderState.isRecording ? "center" : "none",
|
|
197
|
+
alignItems: recorderState.isRecording ? "center" : "none",
|
|
267
198
|
p: "0.5rem 1rem",
|
|
268
199
|
gap: "0.625rem",
|
|
269
200
|
zIndex: "1000",
|
|
270
|
-
children:
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
type: "submit"
|
|
201
|
+
children: isOnlyRecord ? jsxRuntime.jsxs(OnlyRecordButton, {
|
|
202
|
+
theme: theme,
|
|
203
|
+
children: [jsxRuntime.jsx(ReadyRecord.default, {}), jsxRuntime.jsx(material.Typography, {
|
|
204
|
+
variant: "h1",
|
|
205
|
+
children: "\uB179\uC74C \uC2DC\uC791"
|
|
206
|
+
})]
|
|
277
207
|
}) : jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
278
208
|
children: [jsxRuntime.jsx(material.Stack, {
|
|
279
209
|
flexGrow: 1,
|
|
@@ -288,8 +218,8 @@ _EliceChat.InputArea = function (_ref17) {
|
|
|
288
218
|
})
|
|
289
219
|
}), onRecord && jsxRuntime.jsx(IconButton.default, {
|
|
290
220
|
onClick: function onClick() {
|
|
291
|
-
setIsRecord === null || setIsRecord === void 0 ? void 0 : setIsRecord();
|
|
292
221
|
onRecord();
|
|
222
|
+
setIsRecording(true);
|
|
293
223
|
onTranscribingChange === null || onTranscribingChange === void 0 ? void 0 : onTranscribingChange(true);
|
|
294
224
|
},
|
|
295
225
|
children: jsxRuntime.jsx(Micro.default, {
|
|
@@ -310,5 +240,116 @@ _EliceChat.InputArea = function (_ref17) {
|
|
|
310
240
|
})
|
|
311
241
|
});
|
|
312
242
|
};
|
|
243
|
+
var StyledChatContainer = /*#__PURE__*/_styled__default.default(material.Stack, {
|
|
244
|
+
target: "e1i7zt8"
|
|
245
|
+
})("position:relative;max-height:100%;height:", function (_ref4) {
|
|
246
|
+
var height = _ref4.height;
|
|
247
|
+
return height !== null && height !== void 0 ? height : 'fit-content';
|
|
248
|
+
}, ";min-width:30rem;max-width:100%;border:2px solid ", function (_ref5) {
|
|
249
|
+
var theme = _ref5.theme;
|
|
250
|
+
return theme.palette.grey[300];
|
|
251
|
+
}, ";border-radius:1.5rem;padding:1.5rem;gap:1.75rem;", function (_ref6) {
|
|
252
|
+
var backgroundImage = _ref6.backgroundImage;
|
|
253
|
+
return backgroundImage && "\n background-image: url(".concat(backgroundImage, ");\n background-size: cover;\n background-position: center;\n ");
|
|
254
|
+
}, ";");
|
|
255
|
+
var StyledScrollBarStack = /*#__PURE__*/_styled__default.default(material.Stack, {
|
|
256
|
+
target: "e1i7zt7"
|
|
257
|
+
})("flex:1;overflow-y:auto;border-radius:1.125rem;padding-right:1rem;::-webkit-scrollbar{width:0.25rem;}::-webkit-scrollbar-track{background:", function (_ref7) {
|
|
258
|
+
var theme = _ref7.theme;
|
|
259
|
+
return theme.palette.grey[200];
|
|
260
|
+
}, ";border-radius:0.5rem;}::-webkit-scrollbar-thumb{background:", function (_ref8) {
|
|
261
|
+
var theme = _ref8.theme;
|
|
262
|
+
return theme.palette.primary.main;
|
|
263
|
+
}, ";border-radius:0.5rem;}::-webkit-scrollbar-thumb:hover{background:", function (_ref9) {
|
|
264
|
+
var theme = _ref9.theme;
|
|
265
|
+
return theme.palette.secondary.main;
|
|
266
|
+
}, ";}");
|
|
267
|
+
var StyledInput = /*#__PURE__*/_styled__default.default(material.Input, {
|
|
268
|
+
target: "e1i7zt6"
|
|
269
|
+
})("width:100%;height:100%;border:none!important;background-color:transparent;font-size:1.375rem;font-weight:700;outline:none;resize:none;color:", function (_ref10) {
|
|
270
|
+
var theme = _ref10.theme;
|
|
271
|
+
return theme.palette.secondary.main;
|
|
272
|
+
}, ";::placeholder{color:", function (_ref11) {
|
|
273
|
+
var theme = _ref11.theme;
|
|
274
|
+
return theme.palette.grey[300];
|
|
275
|
+
}, ";}::before{border:none;}:hover{::before{border:none;}}::after{border-bottom:none!important;}::-webkit-scrollbar{width:0.25rem;}::-webkit-scrollbar-track{background:", function (_ref12) {
|
|
276
|
+
var theme = _ref12.theme;
|
|
277
|
+
return theme.palette.grey[200];
|
|
278
|
+
}, ";border-radius:0.5rem;}::-webkit-scrollbar-thumb{background:", function (_ref13) {
|
|
279
|
+
var theme = _ref13.theme;
|
|
280
|
+
return theme.palette.primary.main;
|
|
281
|
+
}, ";border-radius:0.5rem;}::-webkit-scrollbar-thumb:hover{background:", function (_ref14) {
|
|
282
|
+
var theme = _ref14.theme;
|
|
283
|
+
return theme.palette.secondary.main;
|
|
284
|
+
}, ";}");
|
|
285
|
+
var StyledMessage = /*#__PURE__*/_styled__default.default(material.Typography, {
|
|
286
|
+
target: "e1i7zt5"
|
|
287
|
+
})("color:", function (_ref15) {
|
|
288
|
+
var isAssistant = _ref15.isAssistant,
|
|
289
|
+
theme = _ref15.theme;
|
|
290
|
+
return isAssistant ? theme.palette.text.secondary : theme.palette.secondary.main;
|
|
291
|
+
}, ";font-size:1rem;font-weight:", function (_ref16) {
|
|
292
|
+
var isAssistant = _ref16.isAssistant;
|
|
293
|
+
return isAssistant ? 500 : 700;
|
|
294
|
+
}, ";background-color:", function (_ref17) {
|
|
295
|
+
var isAssistant = _ref17.isAssistant,
|
|
296
|
+
theme = _ref17.theme;
|
|
297
|
+
return isAssistant ? theme.palette.grey[50] : theme.palette.primary.light;
|
|
298
|
+
}, ";border-radius:1rem;white-space:pre-wrap;padding:0.75rem;margin-bottom:16px;");
|
|
299
|
+
var EmptyMessageContainer = /*#__PURE__*/_styled__default.default(material.Stack, {
|
|
300
|
+
target: "e1i7zt4"
|
|
301
|
+
})("production" === "production" ? {
|
|
302
|
+
name: "1bdo6l4",
|
|
303
|
+
styles: "display:flex;justify-content:center;align-items:center;height:100%;gap:1rem"
|
|
304
|
+
} : {
|
|
305
|
+
name: "1bdo6l4",
|
|
306
|
+
styles: "display:flex;justify-content:center;align-items:center;height:100%;gap:1rem",
|
|
307
|
+
toString: _EMOTION_STRINGIFIED_CSS_ERROR__
|
|
308
|
+
});
|
|
309
|
+
var AIAvatarImage = /*#__PURE__*/_styled__default.default("img", {
|
|
310
|
+
target: "e1i7zt3"
|
|
311
|
+
})("production" === "production" ? {
|
|
312
|
+
name: "1l4h0oe",
|
|
313
|
+
styles: "width:120px;height:120px;flex-shrink:0"
|
|
314
|
+
} : {
|
|
315
|
+
name: "1l4h0oe",
|
|
316
|
+
styles: "width:120px;height:120px;flex-shrink:0",
|
|
317
|
+
toString: _EMOTION_STRINGIFIED_CSS_ERROR__
|
|
318
|
+
});
|
|
319
|
+
var RecordingOverlay = /*#__PURE__*/_styled__default.default(material.Box, {
|
|
320
|
+
target: "e1i7zt2"
|
|
321
|
+
})("production" === "production" ? {
|
|
322
|
+
name: "yb7goz",
|
|
323
|
+
styles: "position:absolute;width:100%;height:100%;top:0;left:0;right:0;bottom:0;z-index:100;display:flex;flex-direction:column;align-items:center;justify-content:flex-end;border-radius:1.5rem;background-color:rgba(0, 0, 0, 0.3);display:flex"
|
|
324
|
+
} : {
|
|
325
|
+
name: "yb7goz",
|
|
326
|
+
styles: "position:absolute;width:100%;height:100%;top:0;left:0;right:0;bottom:0;z-index:100;display:flex;flex-direction:column;align-items:center;justify-content:flex-end;border-radius:1.5rem;background-color:rgba(0, 0, 0, 0.3);display:flex",
|
|
327
|
+
toString: _EMOTION_STRINGIFIED_CSS_ERROR__
|
|
328
|
+
});
|
|
329
|
+
var OverlayContent = /*#__PURE__*/_styled__default.default(material.Box, {
|
|
330
|
+
target: "e1i7zt1"
|
|
331
|
+
})("production" === "production" ? {
|
|
332
|
+
name: "1893fwq",
|
|
333
|
+
styles: "width:100%;height:212px;display:flex;flex-direction:column;align-items:center;justify-content:flex-end"
|
|
334
|
+
} : {
|
|
335
|
+
name: "1893fwq",
|
|
336
|
+
styles: "width:100%;height:212px;display:flex;flex-direction:column;align-items:center;justify-content:flex-end",
|
|
337
|
+
toString: _EMOTION_STRINGIFIED_CSS_ERROR__
|
|
338
|
+
});
|
|
339
|
+
var OnlyRecordButton = /*#__PURE__*/_styled__default.default(material.Stack, {
|
|
340
|
+
target: "e1i7zt0"
|
|
341
|
+
})("color:", function (_ref18) {
|
|
342
|
+
var theme = _ref18.theme;
|
|
343
|
+
return theme.palette.common.white;
|
|
344
|
+
}, ";background:", function (_ref19) {
|
|
345
|
+
var theme = _ref19.theme;
|
|
346
|
+
return theme.palette.common.red[900];
|
|
347
|
+
}, ";&:hover{background:", function (_ref20) {
|
|
348
|
+
var theme = _ref20.theme;
|
|
349
|
+
return theme.palette.common.red[600];
|
|
350
|
+
}, ";color:", function (_ref21) {
|
|
351
|
+
var theme = _ref21.theme;
|
|
352
|
+
return theme.palette.common.red[900];
|
|
353
|
+
}, ";}");
|
|
313
354
|
|
|
314
|
-
exports.default =
|
|
355
|
+
exports.default = EliceChat;
|
package/cjs/components/index.js
CHANGED
|
@@ -23,6 +23,9 @@ var RecorderChat = require('./recorder-chat/RecorderChat.js');
|
|
|
23
23
|
var VideoPlayer = require('./video/VideoPlayer.js');
|
|
24
24
|
var Recorder = require('./recorder/Recorder.js');
|
|
25
25
|
var Audio = require('./audio/Audio.js');
|
|
26
|
+
var SoundVisualizer = require('./sound-visualizer/SoundVisualizer.js');
|
|
27
|
+
var RecorderContext = require('./recorder-step/RecorderContext.js');
|
|
28
|
+
var RecorderStep = require('./recorder-step/RecorderStep.js');
|
|
26
29
|
|
|
27
30
|
|
|
28
31
|
|
|
@@ -49,3 +52,6 @@ exports.EliceRecorderChat = RecorderChat.default;
|
|
|
49
52
|
exports.EliceVideoPlayer = VideoPlayer.default;
|
|
50
53
|
exports.EliceRecorder = Recorder.default;
|
|
51
54
|
exports.EliceAudioPlayer = Audio.default;
|
|
55
|
+
exports.SoundVisualizer = SoundVisualizer.SoundVisualizer;
|
|
56
|
+
exports.RecorderProvider = RecorderContext.RecorderProvider;
|
|
57
|
+
exports.EliceRecorderStep = RecorderStep.default;
|
|
@@ -24,7 +24,7 @@ function _EMOTION_STRINGIFIED_CSS_ERROR__() { return "You have tried to stringif
|
|
|
24
24
|
var EliceLayoutContext = React__default.default.createContext(undefined);
|
|
25
25
|
var MainContainer = /*#__PURE__*/_styled__default.default(material.Stack, {
|
|
26
26
|
target: "efnp08i6"
|
|
27
|
-
})("width:100%;height:100vh;display:flex;flex-direction:column;padding:", function (_ref) {
|
|
27
|
+
})("width:100%;height:100vh;max-width:1280px;display:flex;flex-direction:column;padding:", function (_ref) {
|
|
28
28
|
var isMiniTablet = _ref.isMiniTablet;
|
|
29
29
|
return isMiniTablet ? "0 20px" : "0 40px";
|
|
30
30
|
}, ";box-sizing:border-box;position:relative;background-image:", function (_ref2) {
|
|
@@ -77,7 +77,7 @@ var SubtitleContainer = /*#__PURE__*/_styled__default.default(material.Stack, {
|
|
|
77
77
|
}, ";");
|
|
78
78
|
var _ContentContainer = /*#__PURE__*/_styled__default.default(material.Stack, {
|
|
79
79
|
target: "efnp08i2"
|
|
80
|
-
})("flex:1;width:100%;max-height:calc(100vh - 74px - 92px);overflow-y:auto;min-height:0;position:relative;&::-webkit-scrollbar{width:8px;}&::-webkit-scrollbar-thumb{background-color:", function (_ref10) {
|
|
80
|
+
})("flex:1;width:100%;max-height:calc(100vh - 74px - 92px);max-width:1200px;overflow-y:auto;min-height:0;position:relative;&::-webkit-scrollbar{width:8px;}&::-webkit-scrollbar-thumb{background-color:", function (_ref10) {
|
|
81
81
|
var theme = _ref10.theme;
|
|
82
82
|
return theme.palette.primary.main;
|
|
83
83
|
}, ";border-radius:4px;}&::-webkit-scrollbar-track{background-color:", function (_ref11) {
|
|
@@ -120,6 +120,7 @@ var EliceRecorder = function EliceRecorder(_ref) {
|
|
|
120
120
|
children: [jsxRuntime.jsxs(StyledRecorderButton, {
|
|
121
121
|
step: recordingStep,
|
|
122
122
|
onClick: recordingStep === "ready" || recordingStep === "waiting" ? startRecording : stopRecording,
|
|
123
|
+
theme: theme,
|
|
123
124
|
children: [recordingStep === "ready" || recordingStep === "waiting" ? jsxRuntime.jsx(ReadyRecord.default, {}) : jsxRuntime.jsx(Recording.default, {}), jsxRuntime.jsx(material.Typography, {
|
|
124
125
|
variant: "buttoninput",
|
|
125
126
|
children: recordingStep === "ready" ? "녹음 시작" : recordingStep === "recording" ? "녹음 중지" : "다시 녹음"
|
|
@@ -200,12 +201,17 @@ var WaveBar = /*#__PURE__*/_styled__default.default(material.Box, {
|
|
|
200
201
|
var StyledRecorderButton = /*#__PURE__*/_styled__default.default(material.Button, {
|
|
201
202
|
target: "el6xa1g1"
|
|
202
203
|
})("display:flex;width:160px;border:none;height:55px;padding:12px 20px 12px 17px;justify-content:center;align-items:center;gap:8px;cursor:pointer;flex-shrink:0;border-radius:16px;color:", function (_ref6) {
|
|
203
|
-
var step = _ref6.step
|
|
204
|
-
|
|
204
|
+
var step = _ref6.step,
|
|
205
|
+
theme = _ref6.theme;
|
|
206
|
+
return step === "ready" || step === "waiting" ? theme.palette.common.white : theme.palette.common.red[900];
|
|
205
207
|
}, ";background:", function (_ref7) {
|
|
206
|
-
var step = _ref7.step
|
|
207
|
-
|
|
208
|
-
|
|
208
|
+
var step = _ref7.step,
|
|
209
|
+
theme = _ref7.theme;
|
|
210
|
+
return step === "ready" || step === "waiting" ? theme.palette.common.red[900] : theme.palette.common.red[200];
|
|
211
|
+
}, ";&:hover{background:", function (_ref8) {
|
|
212
|
+
var theme = _ref8.theme;
|
|
213
|
+
return theme.palette.common.red[600];
|
|
214
|
+
}, ";}");
|
|
209
215
|
var StyledRecorderContent = /*#__PURE__*/_styled__default.default(material.Stack, {
|
|
210
216
|
target: "el6xa1g0"
|
|
211
217
|
})("production" === "production" ? {
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import React, { Dispatch } from 'react';
|
|
2
|
+
export type AudioStep = 'ready' | 'recording' | 'pause' | 'waiting';
|
|
3
|
+
export type StepFlowType = 'basic' | 'pauseable' | 'oneClick' | 'recordOnly' | 'instantRecord';
|
|
4
|
+
interface RecorderState {
|
|
5
|
+
step: AudioStep;
|
|
6
|
+
analyser: AnalyserNode | null;
|
|
7
|
+
isRecording: boolean;
|
|
8
|
+
file: File | null;
|
|
9
|
+
audioUrl: string;
|
|
10
|
+
}
|
|
11
|
+
type RecorderContextType = {
|
|
12
|
+
state: RecorderState;
|
|
13
|
+
dispatch: Dispatch<RecorderAction>;
|
|
14
|
+
startRecording: (onComplete?: (file: File) => void) => Promise<void>;
|
|
15
|
+
stopRecording: (isSubmit: boolean) => void;
|
|
16
|
+
pauseRecording: () => void;
|
|
17
|
+
resumeRecording: () => void;
|
|
18
|
+
setIsRecording: (isRecording: boolean) => void;
|
|
19
|
+
};
|
|
20
|
+
type RecorderAction = {
|
|
21
|
+
type: 'SET_STEP';
|
|
22
|
+
payload: AudioStep;
|
|
23
|
+
} | {
|
|
24
|
+
type: 'SET_ANALYSER';
|
|
25
|
+
payload: AnalyserNode | null;
|
|
26
|
+
} | {
|
|
27
|
+
type: 'SET_IS_RECORDING';
|
|
28
|
+
payload: boolean;
|
|
29
|
+
} | {
|
|
30
|
+
type: 'SET_FILE';
|
|
31
|
+
payload: File;
|
|
32
|
+
} | {
|
|
33
|
+
type: 'SET_URL';
|
|
34
|
+
payload: string;
|
|
35
|
+
};
|
|
36
|
+
export declare const RecorderProvider: ({ children }: {
|
|
37
|
+
children: React.ReactNode;
|
|
38
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
39
|
+
export declare const useRecorder: () => RecorderContextType;
|
|
40
|
+
export {};
|