dmed-voice-assistant 1.0.3 → 1.1.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.
@@ -0,0 +1,54 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _material = require("@mui/material");
8
+ const RecognitionListItem = _ref => {
9
+ let {
10
+ data
11
+ } = _ref;
12
+ return /*#__PURE__*/React.createElement(_material.Box, null, /*#__PURE__*/React.createElement(_material.Box, {
13
+ className: "flex items-center justify-between p-[4.5px] bg-[#F6F8FA]"
14
+ }, /*#__PURE__*/React.createElement(_material.Box, {
15
+ className: "flex items-center space-x-1 p-[4px]"
16
+ }, /*#__PURE__*/React.createElement(_material.Typography, {
17
+ className: "!font-bold !text-[14px]",
18
+ color: "#494A48"
19
+ }, data.result.length), /*#__PURE__*/React.createElement(_material.Typography, {
20
+ className: "!font-400 !text-[12px]",
21
+ color: "#494A48"
22
+ }, "words")), /*#__PURE__*/React.createElement(_material.Typography, {
23
+ className: "px-[4px] !font-400 !text-[14px]",
24
+ color: "#494A48"
25
+ }, data.date.toLocaleTimeString('en-US', {
26
+ hour: '2-digit',
27
+ minute: '2-digit',
28
+ hour12: true
29
+ }))), /*#__PURE__*/React.createElement(_material.Box, {
30
+ className: "flex items-center flex-wrap space-x-1 mt-1 p-[9px]",
31
+ sx: {
32
+ maxWidth: "387px",
33
+ overflow: "hidden"
34
+ }
35
+ }, data.result.map((item, index) => {
36
+ return /*#__PURE__*/React.createElement(_material.Box, {
37
+ className: "flex items-center",
38
+ key: index
39
+ }, /*#__PURE__*/React.createElement(_material.Typography, {
40
+ className: "!font-400 !text-[16px]",
41
+ color: "#494A48",
42
+ sx: {
43
+ fontFamily: "Space Grotesk !important"
44
+ }
45
+ }, item), index !== data.result.length - 1 && /*#__PURE__*/React.createElement(_material.Typography, {
46
+ className: "!font-400 !text-[16px]",
47
+ color: "#494A4880",
48
+ sx: {
49
+ fontFamily: "Fira Sans !important"
50
+ }
51
+ }, ","));
52
+ })));
53
+ };
54
+ var _default = exports.default = RecognitionListItem;
@@ -0,0 +1,246 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _react = require("react");
8
+ var _material = require("@mui/material");
9
+ var _svgs = require("./svgs");
10
+ const formatDate = date => {
11
+ const day = String(date.getDate()).padStart(2, '0'); // Get day with leading zero
12
+ const month = String(date.getMonth() + 1).padStart(2, '0'); // Get month (0-indexed, so add 1) with leading zero
13
+ const year = date.getFullYear(); // Get full year
14
+
15
+ return `${day}.${month}.${year}`;
16
+ };
17
+ const formatBytes = bytes => {
18
+ if (bytes === 0) return {
19
+ size: 0,
20
+ type: 'Bytes'
21
+ };
22
+ const sizeUnits = ['Bytes', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'];
23
+ const i = Math.floor(Math.log(bytes) / Math.log(1024)); // Determine the index of the unit
24
+
25
+ const size = (bytes / Math.pow(1024, i)).toFixed(2); // Convert and round to 2 decimal places
26
+ const type = sizeUnits[i]; // Get the unit type
27
+
28
+ return {
29
+ size: parseFloat(size),
30
+ type: type
31
+ };
32
+ };
33
+ const formatTime = seconds => {
34
+ const minutes = Math.floor(seconds / 60); // Calculate minutes
35
+ const remainingSeconds = seconds % 60; // Calculate remaining seconds
36
+
37
+ // Format minutes and seconds to always be two digits
38
+ const formattedMinutes = String(minutes).padStart(2, '0');
39
+ const formattedSeconds = String(remainingSeconds).padStart(2, '0');
40
+ return {
41
+ minutes: formattedMinutes,
42
+ seconds: formattedSeconds
43
+ };
44
+ };
45
+ const RecordListItem = _ref => {
46
+ let {
47
+ audioURL = "",
48
+ label = "",
49
+ createdDate = new Date(),
50
+ capacity = 0,
51
+ time = 0,
52
+ onLabelChange,
53
+ onDelete
54
+ } = _ref;
55
+ const audioRef = (0, _react.useRef)(null);
56
+ const [anchorEl, setAnchorEl] = (0, _react.useState)(null);
57
+ const openAnchorEl = Boolean(anchorEl);
58
+ const [isPlaying, setIsPlaying] = (0, _react.useState)(false);
59
+ const [isEditing, setIsEditing] = (0, _react.useState)(false);
60
+ const [newLabel, setNewLabel] = (0, _react.useState)(label);
61
+ const handlePopoverOpen = event => {
62
+ setAnchorEl(event.currentTarget);
63
+ };
64
+ const handlePopoverClose = () => {
65
+ setAnchorEl(null);
66
+ };
67
+ const handleRename = () => {
68
+ setIsEditing(true);
69
+ handlePopoverClose();
70
+ };
71
+ const handleInputChange = event => {
72
+ setNewLabel(event.target.value);
73
+ };
74
+ const handleInputBlur = () => {
75
+ setIsEditing(false);
76
+ if (newLabel !== label && onLabelChange) {
77
+ onLabelChange(newLabel);
78
+ }
79
+ };
80
+ const handleInputKeyDown = event => {
81
+ if (event.key === "Enter") {
82
+ setIsEditing(false);
83
+ if (newLabel !== label && onLabelChange) {
84
+ onLabelChange(newLabel);
85
+ }
86
+ }
87
+ };
88
+ const playAudio = () => {
89
+ if (!audioRef.current) {
90
+ const audio = new Audio(audioURL);
91
+ audioRef.current = audio;
92
+ audioRef.current.onended = () => {
93
+ URL.revokeObjectURL(audioURL);
94
+ setIsPlaying(false);
95
+ };
96
+ }
97
+ if (isPlaying) {
98
+ audioRef.current.pause();
99
+ setIsPlaying(false);
100
+ } else {
101
+ audioRef.current.play();
102
+ setIsPlaying(true);
103
+ }
104
+ };
105
+ const handleDelete = () => {
106
+ if (onDelete) {
107
+ onDelete();
108
+ }
109
+ handlePopoverClose();
110
+ };
111
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(_material.Box, {
112
+ className: "flex items-center justify-between"
113
+ }, /*#__PURE__*/React.createElement(_material.Box, {
114
+ className: "flex items-center space-x-2"
115
+ }, /*#__PURE__*/React.createElement(_material.Box, {
116
+ className: "cursor-pointer",
117
+ onClick: playAudio
118
+ }, isPlaying ? /*#__PURE__*/React.createElement(_svgs.PauseIcon, null) : /*#__PURE__*/React.createElement(_svgs.BigStartIcon, null)), /*#__PURE__*/React.createElement(_material.Box, null, isEditing ? /*#__PURE__*/React.createElement(_material.TextField, {
119
+ value: newLabel,
120
+ onChange: handleInputChange,
121
+ onBlur: handleInputBlur,
122
+ onKeyDown: handleInputKeyDown,
123
+ variant: "standard",
124
+ autoFocus: true,
125
+ inputProps: {
126
+ style: {
127
+ color: "#EAE5DC",
128
+ fontSize: "16px",
129
+ fontWeight: 600
130
+ }
131
+ },
132
+ sx: {
133
+ input: {
134
+ fontFamily: "Afacad !important"
135
+ }
136
+ }
137
+ }) : /*#__PURE__*/React.createElement(_material.Typography, {
138
+ className: "!font-[600] !text-[16px]",
139
+ color: "#EAE5DC"
140
+ }, newLabel), /*#__PURE__*/React.createElement(_material.Typography, {
141
+ className: "flex items-center !font-[400] !text-[14px]",
142
+ color: "#EAE5DCB2",
143
+ sx: {
144
+ fontFamily: "Afacad !important"
145
+ }
146
+ }, formatDate(createdDate), /*#__PURE__*/React.createElement("svg", {
147
+ className: "mx-1",
148
+ width: "3",
149
+ height: "4",
150
+ viewBox: "0 0 3 4",
151
+ fill: "none",
152
+ xmlns: "http://www.w3.org/2000/svg"
153
+ }, /*#__PURE__*/React.createElement("circle", {
154
+ cx: "1.5",
155
+ cy: "2",
156
+ r: "1.5",
157
+ fill: "#EAE5DC",
158
+ fillOpacity: "0.7"
159
+ })), /*#__PURE__*/React.createElement("span", {
160
+ ref: el => {
161
+ if (el) {
162
+ el.style.setProperty('font-family', 'Afacad', 'important');
163
+ }
164
+ },
165
+ style: {
166
+ fontWeight: "600",
167
+ marginRight: "3px"
168
+ }
169
+ }, formatBytes(capacity).size), formatBytes(capacity).type))), /*#__PURE__*/React.createElement(_material.Typography, {
170
+ className: "!font-[600] !text-[20px]",
171
+ color: "#EAE5DC",
172
+ sx: {
173
+ fontFamily: "Afacad !important"
174
+ }
175
+ }, formatTime(time).minutes, /*#__PURE__*/React.createElement("span", {
176
+ ref: el => {
177
+ if (el) {
178
+ el.style.setProperty('font-family', 'Afacad', 'important');
179
+ }
180
+ },
181
+ style: {
182
+ fontWeight: "400",
183
+ fontSize: "16px",
184
+ marginRight: "5px"
185
+ }
186
+ }, "m"), formatTime(time).seconds, /*#__PURE__*/React.createElement("span", {
187
+ ref: el => {
188
+ if (el) {
189
+ el.style.setProperty('font-family', 'Afacad', 'important');
190
+ }
191
+ },
192
+ style: {
193
+ fontWeight: "400",
194
+ fontSize: "16px"
195
+ }
196
+ }, "s")), /*#__PURE__*/React.createElement(_material.Box, {
197
+ className: "cursor-pointer",
198
+ onClick: handlePopoverOpen
199
+ }, /*#__PURE__*/React.createElement(_svgs.ThreeDotsIcon, null))), /*#__PURE__*/React.createElement(_material.Popover, {
200
+ open: openAnchorEl,
201
+ anchorEl: anchorEl,
202
+ onClose: handlePopoverClose,
203
+ anchorOrigin: {
204
+ vertical: 'bottom',
205
+ horizontal: 'left'
206
+ },
207
+ transformOrigin: {
208
+ vertical: 'bottom',
209
+ horizontal: 'right'
210
+ },
211
+ disableAutoFocus: true,
212
+ disableEnforceFocus: true,
213
+ sx: {
214
+ '& .MuiPaper-root': {
215
+ boxShadow: 'none',
216
+ background: '#0B0B0B',
217
+ borderRadius: '5px'
218
+ }
219
+ }
220
+ }, /*#__PURE__*/React.createElement(_material.Box, {
221
+ className: "px-[5px] pt-[5px] pb-[2.5px] w-[115px]"
222
+ }, /*#__PURE__*/React.createElement(_material.Box, {
223
+ className: "flex items-center justify-between rounded-[5px] px-[10px] py-[3px] cursor-pointer",
224
+ sx: {
225
+ '&:hover': {
226
+ background: '#323232'
227
+ }
228
+ },
229
+ onClick: handleRename
230
+ }, /*#__PURE__*/React.createElement(_material.Box, null, /*#__PURE__*/React.createElement(_svgs.EditIcon, null)), /*#__PURE__*/React.createElement(_material.Typography, {
231
+ className: "!font-400 !text-[12px]",
232
+ color: "#EAE5DC"
233
+ }, "Rename")), /*#__PURE__*/React.createElement(_material.Box, {
234
+ className: "flex items-center justify-between rounded-[5px] px-[10px] py-[3px] cursor-pointer",
235
+ sx: {
236
+ '&:hover': {
237
+ background: '#323232'
238
+ }
239
+ },
240
+ onClick: handleDelete
241
+ }, /*#__PURE__*/React.createElement(_material.Box, null, /*#__PURE__*/React.createElement(_svgs.DeleteIcon, null)), /*#__PURE__*/React.createElement(_material.Typography, {
242
+ className: "!font-400 !text-[12px]",
243
+ color: "#EAE5DC"
244
+ }, "Delete")))));
245
+ };
246
+ var _default = exports.default = RecordListItem;
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _material = require("@mui/material");
8
+ const StyledSelect = (0, _material.styled)(_material.Select)(_ref => {
9
+ let {
10
+ theme
11
+ } = _ref;
12
+ return {
13
+ height: '41.4px',
14
+ border: '0.9px solid #565656',
15
+ borderRadius: '5px',
16
+ maxWidth: '360px',
17
+ '& .MuiOutlinedInput-notchedOutline': {
18
+ border: "none"
19
+ },
20
+ '& svg': {
21
+ fill: '#EAE5DC'
22
+ }
23
+ };
24
+ });
25
+ var _default = exports.default = StyledSelect;