@elicecontents/content-ui 1.0.6 → 1.0.7

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 (51) hide show
  1. package/cjs/components/audio/Audio.d.ts +5 -0
  2. package/cjs/components/audio/Audio.js +91 -0
  3. package/cjs/components/audio/Pause.d.ts +5 -0
  4. package/cjs/components/audio/Pause.js +97 -0
  5. package/cjs/components/audio/Play.d.ts +5 -0
  6. package/cjs/components/audio/Play.js +95 -0
  7. package/cjs/components/audio/index.d.ts +2 -0
  8. package/cjs/components/audio/index.js +7 -0
  9. package/cjs/components/base-input/BaseInput.d.ts +4 -2
  10. package/cjs/components/base-input/BaseInput.js +27 -20
  11. package/cjs/components/index.d.ts +3 -0
  12. package/cjs/components/index.js +6 -0
  13. package/cjs/components/recorder/Recorder.d.ts +6 -0
  14. package/cjs/components/recorder/Recorder.js +218 -0
  15. package/cjs/components/recorder/index.d.ts +2 -0
  16. package/cjs/components/recorder/index.js +7 -0
  17. package/cjs/components/video/VideoPlayer.d.ts +21 -0
  18. package/cjs/components/video/VideoPlayer.js +90 -0
  19. package/cjs/components/video/index.d.ts +2 -0
  20. package/cjs/components/video/index.js +7 -0
  21. package/cjs/icons/NumbersIcon.d.ts +3 -1
  22. package/cjs/icons/NumbersIcon.js +23 -3
  23. package/cjs/index.js +6 -0
  24. package/cjs/typography/typography.d.ts +11 -0
  25. package/cjs/typography/typography.js +9 -0
  26. package/es/components/audio/Audio.d.ts +5 -0
  27. package/es/components/audio/Audio.js +83 -0
  28. package/es/components/audio/Pause.d.ts +5 -0
  29. package/es/components/audio/Pause.js +89 -0
  30. package/es/components/audio/Play.d.ts +5 -0
  31. package/es/components/audio/Play.js +87 -0
  32. package/es/components/audio/index.d.ts +2 -0
  33. package/es/components/audio/index.js +1 -0
  34. package/es/components/base-input/BaseInput.d.ts +4 -2
  35. package/es/components/base-input/BaseInput.js +27 -20
  36. package/es/components/index.d.ts +3 -0
  37. package/es/components/index.js +3 -0
  38. package/es/components/recorder/Recorder.d.ts +6 -0
  39. package/es/components/recorder/Recorder.js +209 -0
  40. package/es/components/recorder/index.d.ts +2 -0
  41. package/es/components/recorder/index.js +1 -0
  42. package/es/components/video/VideoPlayer.d.ts +21 -0
  43. package/es/components/video/VideoPlayer.js +86 -0
  44. package/es/components/video/index.d.ts +2 -0
  45. package/es/components/video/index.js +1 -0
  46. package/es/icons/NumbersIcon.d.ts +3 -1
  47. package/es/icons/NumbersIcon.js +23 -3
  48. package/es/index.js +3 -0
  49. package/es/typography/typography.d.ts +11 -0
  50. package/es/typography/typography.js +9 -0
  51. package/package.json +1 -1
@@ -0,0 +1,5 @@
1
+ export interface EliceAudioPlayerProps {
2
+ src: string;
3
+ }
4
+ declare const EliceAudioPlayer: ({ src }: EliceAudioPlayerProps) => import("react/jsx-runtime").JSX.Element;
5
+ export default EliceAudioPlayer;
@@ -0,0 +1,91 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var _rollupPluginBabelHelpers = require('../../_virtual/_rollupPluginBabelHelpers.js');
6
+ var _styled = require('@emotion/styled/base');
7
+ var jsxRuntime = require('react/jsx-runtime');
8
+ var React = require('react');
9
+ var material = require('@mui/material');
10
+ var Pause = require('./Pause.js');
11
+ var Play = require('./Play.js');
12
+
13
+ function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
14
+
15
+ var _styled__default = /*#__PURE__*/_interopDefaultCompat(_styled);
16
+
17
+ 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)."; }
18
+ var PlayerButton = /*#__PURE__*/_styled__default.default("button", {
19
+ target: "e90no0w0"
20
+ })("production" === "production" ? {
21
+ name: "thmcur",
22
+ styles: "display:flex;background-color:transparent!important;border:none"
23
+ } : {
24
+ name: "thmcur",
25
+ styles: "display:flex;background-color:transparent!important;border:none",
26
+ toString: _EMOTION_STRINGIFIED_CSS_ERROR__
27
+ });
28
+ var EliceAudioPlayer = function EliceAudioPlayer(_ref) {
29
+ var src = _ref.src;
30
+ var audioRef = React.useRef(null);
31
+ var _useState = React.useState(false),
32
+ _useState2 = _rollupPluginBabelHelpers.slicedToArray(_useState, 2),
33
+ isPlaying = _useState2[0],
34
+ setIsPlaying = _useState2[1];
35
+ var _useState3 = React.useState(0),
36
+ _useState4 = _rollupPluginBabelHelpers.slicedToArray(_useState3, 2),
37
+ progress = _useState4[0],
38
+ setProgress = _useState4[1];
39
+ var togglePlay = function togglePlay() {
40
+ var audio = audioRef.current;
41
+ if (!audio) return;
42
+ if (isPlaying) {
43
+ audio.pause();
44
+ } else {
45
+ audio.play();
46
+ }
47
+ };
48
+ React.useEffect(function () {
49
+ var audio = audioRef.current;
50
+ if (!audio) return;
51
+ var handlePlay = function handlePlay() {
52
+ return setIsPlaying(true);
53
+ };
54
+ var handlePause = function handlePause() {
55
+ return setIsPlaying(false);
56
+ };
57
+ var handleTimeUpdate = function handleTimeUpdate() {
58
+ var percent = audio.currentTime / audio.duration * 100;
59
+ setProgress(percent);
60
+ };
61
+ audio.addEventListener('play', handlePlay);
62
+ audio.addEventListener('pause', handlePause);
63
+ audio.addEventListener('timeupdate', handleTimeUpdate);
64
+ return function () {
65
+ audio.removeEventListener('play', handlePlay);
66
+ audio.removeEventListener('pause', handlePause);
67
+ audio.removeEventListener('timeupdate', handleTimeUpdate);
68
+ };
69
+ }, []);
70
+ return jsxRuntime.jsxs(material.Stack, {
71
+ spacing: 1,
72
+ alignItems: "center",
73
+ direction: "row",
74
+ children: [jsxRuntime.jsx("audio", {
75
+ ref: audioRef,
76
+ src: src,
77
+ preload: "auto"
78
+ }), jsxRuntime.jsx(PlayerButton, {
79
+ onClick: togglePlay,
80
+ children: isPlaying ? jsxRuntime.jsx(Pause.default, {}) : jsxRuntime.jsx(Play.default, {})
81
+ }), jsxRuntime.jsx(material.LinearProgress, {
82
+ variant: "determinate",
83
+ value: progress,
84
+ sx: {
85
+ width: '200px'
86
+ }
87
+ })]
88
+ });
89
+ };
90
+
91
+ exports.default = EliceAudioPlayer;
@@ -0,0 +1,5 @@
1
+ declare const PauseIcon: ({ width, height }: {
2
+ width?: number | undefined;
3
+ height?: number | undefined;
4
+ }) => import("react/jsx-runtime").JSX.Element;
5
+ export default PauseIcon;
@@ -0,0 +1,97 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var _styled = require('@emotion/styled/base');
6
+ var jsxRuntime = require('react/jsx-runtime');
7
+ var material = require('@mui/material');
8
+
9
+ function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
10
+
11
+ var _styled__default = /*#__PURE__*/_interopDefaultCompat(_styled);
12
+
13
+ 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)."; }
14
+ var IconWrapper = /*#__PURE__*/_styled__default.default("button", {
15
+ target: "e1qsg1m10"
16
+ })("production" === "production" ? {
17
+ name: "6skc8s",
18
+ styles: "padding:0;border:none;background:transparent;cursor:pointer;&:active svg rect{fill:#7c85b8;}&:active svg path{fill:#f0f0f0;}"
19
+ } : {
20
+ name: "6skc8s",
21
+ styles: "padding:0;border:none;background:transparent;cursor:pointer;&:active svg rect{fill:#7c85b8;}&:active svg path{fill:#f0f0f0;}",
22
+ toString: _EMOTION_STRINGIFIED_CSS_ERROR__
23
+ });
24
+ var PauseIcon = function PauseIcon(_ref) {
25
+ var _ref$width = _ref.width,
26
+ width = _ref$width === void 0 ? 40 : _ref$width,
27
+ _ref$height = _ref.height,
28
+ height = _ref$height === void 0 ? 40 : _ref$height;
29
+ var theme = material.useTheme();
30
+ return jsxRuntime.jsx(IconWrapper, {
31
+ pressColor: theme.palette.secondary.main,
32
+ children: jsxRuntime.jsxs("svg", {
33
+ width: width,
34
+ height: height,
35
+ viewBox: "0 0 54 54",
36
+ fill: "none",
37
+ xmlns: "http://www.w3.org/2000/svg",
38
+ children: [jsxRuntime.jsx("g", {
39
+ filter: "url(#filter0_i_593_3904)",
40
+ children: jsxRuntime.jsx("rect", {
41
+ width: "54",
42
+ height: "54",
43
+ rx: "16",
44
+ fill: theme.palette.primary.main
45
+ })
46
+ }), jsxRuntime.jsx("path", {
47
+ fillRule: "evenodd",
48
+ clipRule: "evenodd",
49
+ d: "M20 17.75H22C23.2426 17.75 24.25 18.7574 24.25 20V34C24.25 35.2426 23.2426 36.25 22 36.25H20C18.7574 36.25 17.75 35.2426 17.75 34V20C17.75 18.7574 18.7574 17.75 20 17.75ZM16 20C16 17.7909 17.7909 16 20 16H22C24.2091 16 26 17.7909 26 20V34C26 36.2091 24.2091 38 22 38H20C17.7909 38 16 36.2091 16 34V20ZM32 17.75H34C35.2426 17.75 36.25 18.7574 36.25 20V34C36.25 35.2427 35.2426 36.25 34 36.25H32C30.7573 36.25 29.75 35.2427 29.75 34V20C29.75 18.7574 30.7573 17.75 32 17.75ZM28 20C28 17.7909 29.7908 16 32 16H34C36.2091 16 38 17.7909 38 20V34C38 36.2092 36.2091 38 34 38H32C29.7908 38 28 36.2092 28 34V20Z",
50
+ fill: "white"
51
+ }), jsxRuntime.jsx("defs", {
52
+ children: jsxRuntime.jsxs("filter", {
53
+ id: "filter0_i_593_3904",
54
+ x: "0",
55
+ y: "0",
56
+ width: "55",
57
+ height: "55",
58
+ filterUnits: "userSpaceOnUse",
59
+ colorInterpolationFilters: "sRGB",
60
+ children: [jsxRuntime.jsx("feFlood", {
61
+ floodOpacity: "0",
62
+ result: "BackgroundImageFix"
63
+ }), jsxRuntime.jsx("feBlend", {
64
+ mode: "normal",
65
+ "in": "SourceGraphic",
66
+ in2: "BackgroundImageFix",
67
+ result: "shape"
68
+ }), jsxRuntime.jsx("feColorMatrix", {
69
+ "in": "SourceAlpha",
70
+ type: "matrix",
71
+ values: "0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0",
72
+ result: "hardAlpha"
73
+ }), jsxRuntime.jsx("feOffset", {
74
+ dx: "1",
75
+ dy: "1"
76
+ }), jsxRuntime.jsx("feGaussianBlur", {
77
+ stdDeviation: "3.3"
78
+ }), jsxRuntime.jsx("feComposite", {
79
+ in2: "hardAlpha",
80
+ operator: "arithmetic",
81
+ k2: "-1",
82
+ k3: "1"
83
+ }), jsxRuntime.jsx("feColorMatrix", {
84
+ type: "matrix",
85
+ values: "0 0 0 0 0.912047 0 0 0 0 0.912047 0 0 0 0 0.940267 0 0 0 1 0"
86
+ }), jsxRuntime.jsx("feBlend", {
87
+ mode: "normal",
88
+ in2: "shape",
89
+ result: "effect1_innerShadow_593_3904"
90
+ })]
91
+ })
92
+ })]
93
+ })
94
+ });
95
+ };
96
+
97
+ exports.default = PauseIcon;
@@ -0,0 +1,5 @@
1
+ declare const PlayIcon: ({ width, height }: {
2
+ width?: number | undefined;
3
+ height?: number | undefined;
4
+ }) => import("react/jsx-runtime").JSX.Element;
5
+ export default PlayIcon;
@@ -0,0 +1,95 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var _styled = require('@emotion/styled/base');
6
+ var jsxRuntime = require('react/jsx-runtime');
7
+ var material = require('@mui/material');
8
+
9
+ function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
10
+
11
+ var _styled__default = /*#__PURE__*/_interopDefaultCompat(_styled);
12
+
13
+ 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)."; }
14
+ var IconWrapper = /*#__PURE__*/_styled__default.default("button", {
15
+ target: "e15psp4j0"
16
+ })("production" === "production" ? {
17
+ name: "6skc8s",
18
+ styles: "padding:0;border:none;background:transparent;cursor:pointer;&:active svg rect{fill:#7c85b8;}&:active svg path{fill:#f0f0f0;}"
19
+ } : {
20
+ name: "6skc8s",
21
+ styles: "padding:0;border:none;background:transparent;cursor:pointer;&:active svg rect{fill:#7c85b8;}&:active svg path{fill:#f0f0f0;}",
22
+ toString: _EMOTION_STRINGIFIED_CSS_ERROR__
23
+ });
24
+ var PlayIcon = function PlayIcon(_ref) {
25
+ var _ref$width = _ref.width,
26
+ width = _ref$width === void 0 ? 40 : _ref$width,
27
+ _ref$height = _ref.height,
28
+ height = _ref$height === void 0 ? 40 : _ref$height;
29
+ var theme = material.useTheme();
30
+ return jsxRuntime.jsx(IconWrapper, {
31
+ pressColor: theme.palette.secondary.main,
32
+ children: jsxRuntime.jsxs("svg", {
33
+ width: width,
34
+ height: height,
35
+ viewBox: "0 0 54 54",
36
+ fill: "none",
37
+ xmlns: "http://www.w3.org/2000/svg",
38
+ children: [jsxRuntime.jsx("g", {
39
+ filter: "url(#filter0_i_274_7284)",
40
+ children: jsxRuntime.jsx("rect", {
41
+ width: "54",
42
+ height: "54",
43
+ rx: "16",
44
+ fill: theme.palette.primary.main
45
+ })
46
+ }), jsxRuntime.jsx("path", {
47
+ d: "M37.1161 29.0649C37.5038 28.8516 37.8228 28.5325 38.0361 28.1448C38.6571 27.0157 38.2452 25.5969 37.1161 24.9759L20.9578 16.0888C20.6133 15.8993 20.2265 15.8 19.8333 15.8C18.5447 15.8 17.5 16.8447 17.5 18.1333V35.9074C17.5 36.3006 17.5994 36.6874 17.7888 37.0319C18.4099 38.161 19.8287 38.5729 20.9578 37.9519L37.1161 29.0649ZM19.5417 17.6317L36.5963 27.0133L19.5417 36.3942V17.6317Z",
48
+ fill: "white"
49
+ }), jsxRuntime.jsx("defs", {
50
+ children: jsxRuntime.jsxs("filter", {
51
+ id: "filter0_i_274_7284",
52
+ x: "0",
53
+ y: "0",
54
+ width: "55",
55
+ height: "55",
56
+ filterUnits: "userSpaceOnUse",
57
+ colorInterpolationFilters: "sRGB",
58
+ children: [jsxRuntime.jsx("feFlood", {
59
+ floodOpacity: "0",
60
+ result: "BackgroundImageFix"
61
+ }), jsxRuntime.jsx("feBlend", {
62
+ mode: "normal",
63
+ "in": "SourceGraphic",
64
+ in2: "BackgroundImageFix",
65
+ result: "shape"
66
+ }), jsxRuntime.jsx("feColorMatrix", {
67
+ "in": "SourceAlpha",
68
+ type: "matrix",
69
+ values: "0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0",
70
+ result: "hardAlpha"
71
+ }), jsxRuntime.jsx("feOffset", {
72
+ dx: "1",
73
+ dy: "1"
74
+ }), jsxRuntime.jsx("feGaussianBlur", {
75
+ stdDeviation: "3.3"
76
+ }), jsxRuntime.jsx("feComposite", {
77
+ in2: "hardAlpha",
78
+ operator: "arithmetic",
79
+ k2: "-1",
80
+ k3: "1"
81
+ }), jsxRuntime.jsx("feColorMatrix", {
82
+ type: "matrix",
83
+ values: "0 0 0 0 0.912047 0 0 0 0 0.912047 0 0 0 0 0.940267 0 0 0 1 0"
84
+ }), jsxRuntime.jsx("feBlend", {
85
+ mode: "normal",
86
+ in2: "shape",
87
+ result: "effect1_innerShadow_274_7284"
88
+ })]
89
+ })
90
+ })]
91
+ })
92
+ });
93
+ };
94
+
95
+ exports.default = PlayIcon;
@@ -0,0 +1,2 @@
1
+ export { default as EliceAudioPlayer } from './Audio';
2
+ export type { EliceAudioPlayerProps } from './Audio';
@@ -0,0 +1,7 @@
1
+ 'use strict';
2
+
3
+ var Audio = require('./Audio.js');
4
+
5
+
6
+
7
+ exports.EliceAudioPlayer = Audio.default;
@@ -1,12 +1,14 @@
1
1
  import React from "react";
2
+ export type BaseInputType = "normal" | "area";
2
3
  export interface BaseInputProps {
3
4
  value: string;
4
5
  onChange: (e: React.ChangeEvent<HTMLInputElement>) => void;
5
6
  placeholder?: string;
6
7
  children?: React.ReactNode;
7
- isDisabled: boolean;
8
+ isDisabled?: boolean;
9
+ inputType: BaseInputType;
8
10
  }
9
- declare const BaseInput: (({ value, onChange, placeholder, children, isDisabled, }: BaseInputProps) => import("react/jsx-runtime").JSX.Element) & {
11
+ declare const BaseInput: (({ value, onChange, placeholder, children, isDisabled, inputType, }: BaseInputProps) => import("react/jsx-runtime").JSX.Element) & {
10
12
  LeftElement: ({ children }: {
11
13
  children?: React.ReactNode;
12
14
  }) => import("react/jsx-runtime").JSX.Element;
@@ -13,14 +13,17 @@ var _styled__default = /*#__PURE__*/_interopDefaultCompat(_styled);
13
13
  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)."; }
14
14
  var BaseInputContainer = /*#__PURE__*/_styled__default.default("div", {
15
15
  target: "e8c2rcu3"
16
- })("production" === "production" ? {
17
- name: "phlljc",
18
- styles: "display:flex;align-items:center;gap:8px;width:100%"
19
- } : {
20
- name: "phlljc",
21
- styles: "display:flex;align-items:center;gap:8px;width:100%",
22
- toString: _EMOTION_STRINGIFIED_CSS_ERROR__
23
- });
16
+ })("display:flex;align-items:center;gap:8px;width:100%;border:", function (_ref) {
17
+ var type = _ref.type,
18
+ borderColor = _ref.borderColor;
19
+ return type !== "normal" ? "1px solid ".concat(borderColor) : "none";
20
+ }, ";border-radius:", function (_ref2) {
21
+ var type = _ref2.type;
22
+ return type !== "normal" ? "1.5rem" : "none";
23
+ }, ";padding:", function (_ref3) {
24
+ var type = _ref3.type;
25
+ return type !== "normal" ? "1.375rem 1.5rem" : "none";
26
+ }, ";");
24
27
  var BaseInputContent = /*#__PURE__*/_styled__default.default("div", {
25
28
  target: "e8c2rcu2"
26
29
  })("production" === "production" ? {
@@ -43,21 +46,25 @@ var InputText = /*#__PURE__*/_styled__default.default("input", {
43
46
  });
44
47
  var UnderLineDivider = /*#__PURE__*/_styled__default.default("div", {
45
48
  target: "e8c2rcu0"
46
- })("width:100%;height:2px;background-color:", function (_ref) {
47
- var theme = _ref.theme;
49
+ })("width:100%;height:2px;background-color:", function (_ref4) {
50
+ var theme = _ref4.theme;
48
51
  return theme.palette.primary.main;
49
52
  }, ";");
50
53
  // ✅ 합성 컴포넌트 패턴 적용
51
- var BaseInput = Object.assign(function (_ref2) {
52
- var value = _ref2.value,
53
- onChange = _ref2.onChange,
54
- _ref2$placeholder = _ref2.placeholder,
55
- placeholder = _ref2$placeholder === void 0 ? "Enter text..." : _ref2$placeholder,
56
- children = _ref2.children,
57
- _ref2$isDisabled = _ref2.isDisabled,
58
- isDisabled = _ref2$isDisabled === void 0 ? false : _ref2$isDisabled;
54
+ var BaseInput = Object.assign(function (_ref5) {
55
+ var value = _ref5.value,
56
+ onChange = _ref5.onChange,
57
+ _ref5$placeholder = _ref5.placeholder,
58
+ placeholder = _ref5$placeholder === void 0 ? "Enter text..." : _ref5$placeholder,
59
+ children = _ref5.children,
60
+ _ref5$isDisabled = _ref5.isDisabled,
61
+ isDisabled = _ref5$isDisabled === void 0 ? false : _ref5$isDisabled,
62
+ _ref5$inputType = _ref5.inputType,
63
+ inputType = _ref5$inputType === void 0 ? "normal" : _ref5$inputType;
59
64
  var theme = material.useTheme();
60
65
  return jsxRuntime.jsxs(BaseInputContainer, {
66
+ type: inputType,
67
+ borderColor: theme.palette.secondary.main,
61
68
  children: [children && jsxRuntime.jsx("div", {
62
69
  children: children
63
70
  }), " ", jsxRuntime.jsxs(BaseInputContent, {
@@ -72,8 +79,8 @@ var BaseInput = Object.assign(function (_ref2) {
72
79
  })]
73
80
  });
74
81
  }, {
75
- LeftElement: function LeftElement(_ref3) {
76
- var children = _ref3.children;
82
+ LeftElement: function LeftElement(_ref6) {
83
+ var children = _ref6.children;
77
84
  return jsxRuntime.jsx(jsxRuntime.Fragment, {
78
85
  children: children
79
86
  });
@@ -20,3 +20,6 @@ export * from './subtitle-button';
20
20
  export * from './base-input';
21
21
  export * from './Modal';
22
22
  export * from './recorder-chat';
23
+ export * from './video';
24
+ export * from './recorder';
25
+ export * from './audio';
@@ -20,6 +20,9 @@ var SubtitleButton = require('./subtitle-button/SubtitleButton.js');
20
20
  var BaseInput = require('./base-input/BaseInput.js');
21
21
  var Modal = require('./Modal/Modal.js');
22
22
  var RecorderChat = require('./recorder-chat/RecorderChat.js');
23
+ var VideoPlayer = require('./video/VideoPlayer.js');
24
+ var Recorder = require('./recorder/Recorder.js');
25
+ var Audio = require('./audio/Audio.js');
23
26
 
24
27
 
25
28
 
@@ -43,3 +46,6 @@ exports.EliceSubButton = SubtitleButton.default;
43
46
  exports.BaseInput = BaseInput.default;
44
47
  exports.EliceModal = Modal.default;
45
48
  exports.EliceRecorderChat = RecorderChat.default;
49
+ exports.EliceVideoPlayer = VideoPlayer.default;
50
+ exports.EliceRecorder = Recorder.default;
51
+ exports.EliceAudioPlayer = Audio.default;
@@ -0,0 +1,6 @@
1
+ export interface EliceRecorderProps {
2
+ onAudioReady: (file: File) => void;
3
+ onTransform?: () => void;
4
+ }
5
+ declare const EliceRecorder: ({ onAudioReady, onTransform }: EliceRecorderProps) => import("react/jsx-runtime").JSX.Element;
6
+ export default EliceRecorder;
@@ -0,0 +1,218 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var _rollupPluginBabelHelpers = require('../../_virtual/_rollupPluginBabelHelpers.js');
6
+ var _styled = require('@emotion/styled/base');
7
+ var jsxRuntime = require('react/jsx-runtime');
8
+ var React = require('react');
9
+ var material = require('@mui/material');
10
+ require('tslib');
11
+ var Recording = require('../../icons/Recording.js');
12
+ var ReadyRecord = require('../../icons/ReadyRecord.js');
13
+ var Button = require('../button/Button.js');
14
+
15
+ function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
16
+
17
+ var _styled__default = /*#__PURE__*/_interopDefaultCompat(_styled);
18
+
19
+ 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)."; }
20
+ var EliceRecorder = function EliceRecorder(_ref) {
21
+ var onAudioReady = _ref.onAudioReady,
22
+ onTransform = _ref.onTransform;
23
+ var theme = material.useTheme();
24
+ var _useState = React.useState("ready"),
25
+ _useState2 = _rollupPluginBabelHelpers.slicedToArray(_useState, 2),
26
+ recordingStep = _useState2[0],
27
+ setRecordingStep = _useState2[1];
28
+ var mediaRecorderRef = React.useRef(null);
29
+ var audioChunks = React.useRef([]);
30
+ var streamRef = React.useRef(null);
31
+ var audioContextRef = React.useRef(null);
32
+ var analyserRef = React.useRef(null);
33
+ var sourceRef = React.useRef(null);
34
+ var startRecording = /*#__PURE__*/function () {
35
+ var _ref2 = _rollupPluginBabelHelpers.asyncToGenerator(/*#__PURE__*/_rollupPluginBabelHelpers.regeneratorRuntime().mark(function _callee2() {
36
+ var audioStream;
37
+ return _rollupPluginBabelHelpers.regeneratorRuntime().wrap(function _callee2$(_context2) {
38
+ while (1) switch (_context2.prev = _context2.next) {
39
+ case 0:
40
+ _context2.prev = 0;
41
+ _context2.next = 3;
42
+ return navigator.mediaDevices.getUserMedia({
43
+ audio: true
44
+ });
45
+ case 3:
46
+ audioStream = _context2.sent;
47
+ streamRef.current = audioStream;
48
+ audioChunks.current = [];
49
+ mediaRecorderRef.current = new MediaRecorder(audioStream);
50
+ mediaRecorderRef.current.ondataavailable = function (event) {
51
+ if (event.data.size > 0) {
52
+ audioChunks.current.push(event.data);
53
+ }
54
+ };
55
+ mediaRecorderRef.current.onstop = /*#__PURE__*/_rollupPluginBabelHelpers.asyncToGenerator(/*#__PURE__*/_rollupPluginBabelHelpers.regeneratorRuntime().mark(function _callee() {
56
+ var audioBlob, file;
57
+ return _rollupPluginBabelHelpers.regeneratorRuntime().wrap(function _callee$(_context) {
58
+ while (1) switch (_context.prev = _context.next) {
59
+ case 0:
60
+ audioBlob = new Blob(audioChunks.current, {
61
+ type: "audio/wav"
62
+ });
63
+ file = new File([audioBlob], "recording-".concat(Date.now(), ".wav"), {
64
+ type: "audio/wav"
65
+ });
66
+ onAudioReady(file);
67
+ case 3:
68
+ case "end":
69
+ return _context.stop();
70
+ }
71
+ }, _callee);
72
+ }));
73
+ // ✅ 음성 분석용 AudioContext 연결
74
+ audioContextRef.current = new AudioContext();
75
+ analyserRef.current = audioContextRef.current.createAnalyser();
76
+ sourceRef.current = audioContextRef.current.createMediaStreamSource(audioStream);
77
+ sourceRef.current.connect(analyserRef.current);
78
+ mediaRecorderRef.current.start();
79
+ setRecordingStep("recording");
80
+ _context2.next = 20;
81
+ break;
82
+ case 17:
83
+ _context2.prev = 17;
84
+ _context2.t0 = _context2["catch"](0);
85
+ console.error("🎤 마이크 권한을 허용해주세요.", _context2.t0);
86
+ case 20:
87
+ case "end":
88
+ return _context2.stop();
89
+ }
90
+ }, _callee2, null, [[0, 17]]);
91
+ }));
92
+ return function startRecording() {
93
+ return _ref2.apply(this, arguments);
94
+ };
95
+ }();
96
+ var stopRecording = function stopRecording() {
97
+ var _a, _b, _c;
98
+ (_a = mediaRecorderRef.current) === null || _a === void 0 ? void 0 : _a.stop();
99
+ (_b = streamRef.current) === null || _b === void 0 ? void 0 : _b.getTracks().forEach(function (track) {
100
+ return track.stop();
101
+ });
102
+ (_c = audioContextRef.current) === null || _c === void 0 ? void 0 : _c.close();
103
+ audioContextRef.current = null;
104
+ setRecordingStep("waiting");
105
+ };
106
+ return jsxRuntime.jsxs(material.Stack, {
107
+ direction: "column",
108
+ minHeight: "70px",
109
+ bgcolor: theme.palette.grey[50],
110
+ padding: "12px 9px",
111
+ borderRadius: "18px",
112
+ alignItems: "center",
113
+ justifyContent: "center",
114
+ children: [jsxRuntime.jsx(SoundWaveVisualizer, {
115
+ analyser: analyserRef.current
116
+ }), jsxRuntime.jsxs(StyledRecorderContent, {
117
+ direction: "row",
118
+ children: [jsxRuntime.jsxs(StyledRecorderButton, {
119
+ step: recordingStep,
120
+ onClick: recordingStep === "ready" ? startRecording : stopRecording,
121
+ children: [recordingStep === "ready" || recordingStep === "waiting" ? jsxRuntime.jsx(ReadyRecord.default, {}) : jsxRuntime.jsx(Recording.default, {}), jsxRuntime.jsx(material.Typography, {
122
+ variant: "buttoninput",
123
+ children: recordingStep === "ready" ? "녹음 시작" : recordingStep === "recording" ? "녹음 중지" : "다시 녹음"
124
+ })]
125
+ }), jsxRuntime.jsx(Button.default, {
126
+ disabled: recordingStep !== "waiting",
127
+ variant: recordingStep === "waiting" ? "outlined" : "contained",
128
+ onClick: onTransform,
129
+ children: "\uBCC0\uD658"
130
+ })]
131
+ })]
132
+ });
133
+ };
134
+ var SoundWaveVisualizer = function SoundWaveVisualizer(_ref4) {
135
+ var analyser = _ref4.analyser;
136
+ var theme = material.useTheme();
137
+ var TOTAL_BARS = 17;
138
+ var _useState3 = React.useState(0),
139
+ _useState4 = _rollupPluginBabelHelpers.slicedToArray(_useState3, 2),
140
+ filledBars = _useState4[0],
141
+ setFilledBars = _useState4[1];
142
+ React.useEffect(function () {
143
+ if (!analyser) return;
144
+ analyser.fftSize = 128; // ✅ FFT 크기 줄여 반응속도 개선
145
+ var dataArray = new Uint8Array(analyser.frequencyBinCount);
146
+ var prevVolume = 0;
147
+ var _updateVolume = function updateVolume() {
148
+ analyser.getByteFrequencyData(dataArray);
149
+ var averageVolume = dataArray.reduce(function (acc, val) {
150
+ return acc + val;
151
+ }, 0) / dataArray.length;
152
+ // ✅ 더 높은 민감도 설정 (3배 증폭)
153
+ var scaledVolume = Math.min(averageVolume * 3, 255);
154
+ // ✅ 더 높은 가중치를 현재 값에 적용 (빠르게 반응)
155
+ var smoothedVolume = prevVolume * 0.5 + scaledVolume * 0.5;
156
+ prevVolume = smoothedVolume;
157
+ // ✅ TOTAL_BARS에 맞게 변환
158
+ var newFilledBars = Math.floor(smoothedVolume / 255 * TOTAL_BARS);
159
+ setFilledBars(function (prev) {
160
+ return Math.round(prev * 0.6 + newFilledBars * 0.4);
161
+ }); // ✅ 더 빠르게 반응
162
+ requestAnimationFrame(_updateVolume);
163
+ };
164
+ _updateVolume();
165
+ return function () {
166
+ return setFilledBars(0);
167
+ };
168
+ }, [analyser]);
169
+ return jsxRuntime.jsx(material.Stack, {
170
+ alignItems: "center",
171
+ justifyContent: "center",
172
+ width: "100%",
173
+ bgcolor: "transparent",
174
+ children: jsxRuntime.jsx(material.Box, {
175
+ display: "flex",
176
+ justifyContent: "center",
177
+ alignItems: "center",
178
+ p: "6px 36px 7.5px 31px",
179
+ width: "100%",
180
+ gap: "11px",
181
+ bgcolor: theme.palette.grey[50],
182
+ children: Array(TOTAL_BARS).fill(0).map(function (_, idx) {
183
+ return jsxRuntime.jsx(WaveBar, {
184
+ isFilled: idx < filledBars,
185
+ theme: theme
186
+ }, idx);
187
+ })
188
+ })
189
+ });
190
+ };
191
+ var WaveBar = /*#__PURE__*/_styled__default.default(material.Box, {
192
+ target: "el6xa1g2"
193
+ })("width:11px;height:34px;border-radius:11px;background-color:", function (_ref5) {
194
+ var isFilled = _ref5.isFilled,
195
+ theme = _ref5.theme;
196
+ return isFilled ? theme.palette.primary.main : theme.palette.grey[200];
197
+ }, ";transition:background-color 0.1s ease-in-out;");
198
+ var StyledRecorderButton = /*#__PURE__*/_styled__default.default(material.Button, {
199
+ target: "el6xa1g1"
200
+ })("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) {
201
+ var step = _ref6.step;
202
+ return step === "ready" || step === "waiting" ? "#fff" : "#FF5D58";
203
+ }, ";background:", function (_ref7) {
204
+ var step = _ref7.step;
205
+ return step === "ready" || step === "waiting" ? "#FF5D58" : "#FBE0E0";
206
+ }, ";");
207
+ var StyledRecorderContent = /*#__PURE__*/_styled__default.default(material.Stack, {
208
+ target: "el6xa1g0"
209
+ })("production" === "production" ? {
210
+ name: "o9fzdr",
211
+ styles: "width:100%;display:flex;justify-content:center;align-items:center;gap:16px"
212
+ } : {
213
+ name: "o9fzdr",
214
+ styles: "width:100%;display:flex;justify-content:center;align-items:center;gap:16px",
215
+ toString: _EMOTION_STRINGIFIED_CSS_ERROR__
216
+ });
217
+
218
+ exports.default = EliceRecorder;
@@ -0,0 +1,2 @@
1
+ export { default as EliceRecorder } from './Recorder';
2
+ export type { EliceRecorderProps } from './Recorder';