@apple-pie/slice 0.1.22 → 0.1.24
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/dist/cjs/chunks/AudioBubble-C8HdYBY8.js +54 -0
- package/dist/cjs/chunks/{Button-KGA0e9-0.js → Button-DmWbooXb.js} +1 -1
- package/dist/cjs/chunks/{DropDown-CJH-Y6Z5.js → DropDown-Cy2o78yw.js} +3 -3
- package/dist/cjs/chunks/{FileList-CIRALfrW.js → FileList-DjTXjXnK.js} +1 -1
- package/dist/cjs/chunks/{ProgressIndicator-DETWiASA.js → ProgressIndicator-8QZwTSyY.js} +3 -2
- package/dist/cjs/chunks/{PromptInput-DUxwal3V.js → PromptInput-D1wP5-uN.js} +1 -1
- package/dist/cjs/chunks/{TextArea-mSespe9z.js → TextArea-CtJi771p.js} +2 -2
- package/dist/cjs/chunks/{TextField-Cz2lh-fP.js → TextField-B2u_CZKk.js} +2 -2
- package/dist/cjs/chunks/{UploadArea-CtvvqLU7.js → UploadArea-BS2BPuhZ.js} +1 -1
- package/dist/cjs/chunks/audioVisualizer-EIfIjWH7.js +60 -0
- package/dist/cjs/components/AudioBubble/index.js +10 -0
- package/dist/cjs/components/Button/index.js +2 -2
- package/dist/cjs/components/DropDown/index.js +1 -1
- package/dist/cjs/components/FileList/index.js +2 -2
- package/dist/cjs/components/Progress/index.js +1 -1
- package/dist/cjs/components/PromptInput/index.js +4 -4
- package/dist/cjs/components/TextArea/index.js +3 -3
- package/dist/cjs/components/Textfield/index.js +3 -3
- package/dist/cjs/components/UploadArea/index.js +3 -3
- package/dist/cjs/hooks/useAudioRecorder.js +70 -0
- package/dist/cjs/hooks/useMicrophone.js +142 -0
- package/dist/cjs/hooks.js +3 -2
- package/dist/cjs/index.js +14 -12
- package/dist/cjs/utils/index.js +3 -3
- package/dist/cjs/utils/objects/index.js +3 -3
- package/dist/esm/chunks/AudioBubble-DFh3Vxl6.mjs +62 -0
- package/dist/esm/chunks/{Avatar-CSLVUF_y.mjs → Avatar-C8uV7ROZ.mjs} +2 -2
- package/dist/esm/chunks/{AvatarGroup--ELW-bO1.mjs → AvatarGroup-Bt1Lkn5S.mjs} +2 -2
- package/dist/esm/chunks/{Badge-DyICxZP2.mjs → Badge-D-U1jomY.mjs} +1 -1
- package/dist/esm/chunks/{Button-Bp51g5jC.mjs → Button-sEYjFcR2.mjs} +5 -5
- package/dist/esm/chunks/{ButtonBar-BK-uB7oe.mjs → ButtonBar-DSR2lhhN.mjs} +3 -3
- package/dist/esm/chunks/{Camera-BYi_Aqbl.mjs → Camera-DSSiOeJd.mjs} +4 -4
- package/dist/esm/chunks/{CheckBox-BB5olQbT.mjs → CheckBox-B6zWSySW.mjs} +3 -3
- package/dist/esm/chunks/{Chip-CxqFCtT6.mjs → Chip-BBKJ6wG4.mjs} +3 -3
- package/dist/esm/chunks/{DivInput-DeSpC8Wm.mjs → DivInput-cIMIH07H.mjs} +2 -2
- package/dist/esm/chunks/{Dot-CLGwQu-i.mjs → Dot-Cj6gWj4_.mjs} +1 -1
- package/dist/esm/chunks/{DrggablePanel-BfBCRXa8.mjs → DrggablePanel-CQcIbxpX.mjs} +2 -2
- package/dist/esm/chunks/{DropDown-CK-sPjsQ.mjs → DropDown-DFUc_rjP.mjs} +6 -6
- package/dist/esm/chunks/{ErrorSummary-BNdjCQbn.mjs → ErrorSummary-Mz9siVxm.mjs} +1 -1
- package/dist/esm/chunks/{FileIcon-BXKnFJBn.mjs → FileIcon-DeW-ZBiv.mjs} +2 -2
- package/dist/esm/chunks/{FileList-CyUhkk-m.mjs → FileList-0Dzx15hl.mjs} +5 -5
- package/dist/esm/chunks/{Grouper-Daz1o_Ai.mjs → Grouper-B04WxD6K.mjs} +3 -3
- package/dist/esm/chunks/{Icon-CbwaBi0l.mjs → Icon-KDwlMXzH.mjs} +2 -2
- package/dist/esm/chunks/{IconButton-BKZD9jsp.mjs → IconButton-oAB8ZFTf.mjs} +4 -4
- package/dist/esm/chunks/{IndexedDB-CJgzPHPB.mjs → IndexedDB-Dk7a4fPS.mjs} +1 -1
- package/dist/esm/chunks/{Label-QTsUvGme.mjs → Label-BD7VlTDw.mjs} +2 -2
- package/dist/esm/chunks/{Overlay-TOzZXnwF.mjs → Overlay-3KkyDm1f.mjs} +1 -1
- package/dist/esm/chunks/{Pager-BYT7_mCb.mjs → Pager-DmiwYLl5.mjs} +2 -2
- package/dist/esm/chunks/{ProgressIndicator-Cg7CCrAE.mjs → ProgressIndicator-CxsZm_As.mjs} +5 -4
- package/dist/esm/chunks/{PromptInput-DJInpjRX.mjs → PromptInput-D4Q-DWjz.mjs} +3 -3
- package/dist/esm/chunks/{RadioButton-CYp8RkDK.mjs → RadioButton-B0jvM5VW.mjs} +3 -3
- package/dist/esm/chunks/{RadioButtonList-BSzV9Zz-.mjs → RadioButtonList-DBRAv87_.mjs} +3 -3
- package/dist/esm/chunks/{Slider-DL2iuNlh.mjs → Slider-CONGTXUE.mjs} +2 -2
- package/dist/esm/chunks/{Spacer-BlgEdKEM.mjs → Spacer-C5fcJYq-.mjs} +1 -1
- package/dist/esm/chunks/{Switch-BhCOo5Lu.mjs → Switch-CyoaJwSX.mjs} +1 -1
- package/dist/esm/chunks/{TabBar-Dd5-VZcG.mjs → TabBar-DmO1ixBz.mjs} +4 -4
- package/dist/esm/chunks/{TextArea-C_2D7sZV.mjs → TextArea-DaB8g-fZ.mjs} +3 -3
- package/dist/esm/chunks/{TextField-RG1AsLTh.mjs → TextField-BGeEJXUJ.mjs} +6 -6
- package/dist/esm/chunks/{Tip-BnKB9qMi.mjs → Tip-DrQvxDsH.mjs} +2 -2
- package/dist/esm/chunks/{Toast-BfuKRAns.mjs → Toast-C5XSDgno.mjs} +3 -3
- package/dist/esm/chunks/{UploadArea-ByvnUxhr.mjs → UploadArea-Gpq-MhqB.mjs} +4 -4
- package/dist/esm/chunks/{WSConnection-D9mpsVdc.mjs → WSConnection-DV7k84B4.mjs} +1 -1
- package/dist/esm/chunks/{_types-CPrEyJX9.mjs → _types-DOQAaLqq.mjs} +1 -1
- package/dist/esm/chunks/audioVisualizer-ZgT77nUw.mjs +60 -0
- package/dist/esm/chunks/{localDBStore-B4jkR5Jx.mjs → localDBStore-Dnpo5nSv.mjs} +2 -2
- package/dist/esm/chunks/{misc-N8KLjOXc.mjs → misc-BeEWwOaJ.mjs} +1 -1
- package/dist/esm/chunks/{sseStore-2JIpEKfz.mjs → sseStore-DjrfpNAS.mjs} +1 -1
- package/dist/esm/chunks/{tslib.es6-c-7TIv71.mjs → tslib.es6-C-olHjXV.mjs} +1 -1
- package/dist/esm/chunks/{uploads-worker-Dv-4zGnC.mjs → uploads-worker-7X9EwX9N.mjs} +1 -1
- package/dist/esm/chunks/{uploadsStore-D69fEXMY.mjs → uploadsStore-B7VECR5Q.mjs} +1 -1
- package/dist/esm/chunks/{windowStore-BOTh1g37.mjs → windowStore-CAzx2-QV.mjs} +1 -1
- package/dist/esm/components/AudioBubble/index.mjs +31 -0
- package/dist/esm/components/Avatar/index.mjs +3 -3
- package/dist/esm/components/AvatarGroup/index.mjs +4 -4
- package/dist/esm/components/Badge/index.mjs +2 -2
- package/dist/esm/components/Button/index.mjs +7 -7
- package/dist/esm/components/ButtonBar/index.mjs +4 -4
- package/dist/esm/components/Camera/index.mjs +5 -5
- package/dist/esm/components/CheckBox/index.mjs +4 -4
- package/dist/esm/components/Chip/index.mjs +4 -4
- package/dist/esm/components/DivInput/index.mjs +3 -3
- package/dist/esm/components/Dot/index.mjs +2 -2
- package/dist/esm/components/DraggablePanel/index.mjs +3 -3
- package/dist/esm/components/DropDown/index.mjs +4 -4
- package/dist/esm/components/ErrorSummary/index.mjs +2 -2
- package/dist/esm/components/FileIcon/index.mjs +3 -3
- package/dist/esm/components/FileList/index.mjs +6 -6
- package/dist/esm/components/FlexDiv/index.mjs +2 -2
- package/dist/esm/components/Grouper/index.mjs +5 -5
- package/dist/esm/components/Icon/index.mjs +3 -3
- package/dist/esm/components/IconButton/index.mjs +6 -6
- package/dist/esm/components/Label/index.mjs +3 -3
- package/dist/esm/components/Overlay/index.mjs +2 -2
- package/dist/esm/components/Pager/index.mjs +3 -3
- package/dist/esm/components/Progress/index.mjs +4 -4
- package/dist/esm/components/PromptInput/index.mjs +10 -10
- package/dist/esm/components/RadioButton/index.mjs +4 -4
- package/dist/esm/components/RadioButtonList/index.mjs +5 -5
- package/dist/esm/components/Slider/index.mjs +3 -3
- package/dist/esm/components/Spacer/index.mjs +2 -2
- package/dist/esm/components/Switch/index.mjs +2 -2
- package/dist/esm/components/TabBar/index.mjs +7 -7
- package/dist/esm/components/TextArea/index.mjs +8 -8
- package/dist/esm/components/Textfield/index.mjs +9 -9
- package/dist/esm/components/Tip/index.mjs +3 -3
- package/dist/esm/components/Toast/index.mjs +4 -4
- package/dist/esm/components/UploadArea/index.mjs +7 -7
- package/dist/esm/hooks/useAudioRecorder.mjs +74 -0
- package/dist/esm/hooks/useMdStreamBuffer.mjs +1 -1
- package/dist/esm/hooks/useMicrophone.mjs +144 -0
- package/dist/esm/hooks/useTrackRenders.mjs +2 -2
- package/dist/esm/hooks.mjs +5 -1
- package/dist/esm/index.mjs +47 -39
- package/dist/esm/stores/LocalDB.mjs +3 -3
- package/dist/esm/stores/SSE.mjs +2 -2
- package/dist/esm/stores/WS.mjs +2 -2
- package/dist/esm/stores/uploads.mjs +3 -3
- package/dist/esm/stores/window.mjs +2 -2
- package/dist/esm/stores.mjs +7 -7
- package/dist/esm/utils/index.mjs +6 -4
- package/dist/esm/utils/objects/index.mjs +5 -3
- package/dist/esm/workers/uploads/uploads.mjs +2 -2
- package/dist/types/components/AudioBubble/AudioBubble.d.ts +3 -0
- package/dist/types/components/AudioBubble/_types.d.ts +18 -0
- package/dist/types/components/AudioBubble/index.d.ts +2 -0
- package/dist/types/components/DropDown/_types.d.ts +1 -0
- package/dist/types/hooks/index.d.ts +3 -0
- package/dist/types/hooks/useAudioRecorder/useAudioRecorder.d.ts +14 -0
- package/dist/types/hooks/useMicrophone/useMicrophone.d.ts +23 -0
- package/dist/types/index.d.ts +3 -1
- package/dist/types/utils/functions/files.d.ts +1 -1
- package/dist/types/utils/index.d.ts +2 -2
- package/dist/types/utils/objects/WebRTCConnection/WebRTCConnection.d.ts +86 -0
- package/dist/types/utils/objects/WebRTCConnection/_types.d.ts +11 -0
- package/dist/types/utils/objects/audioVisualizer/audioVisualizer.d.ts +40 -0
- package/dist/types/utils/objects/index.d.ts +2 -0
- package/package.json +1 -1
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var tslib_es6 = require("../chunks/tslib.es6-C8dZW5nY.js"), React = require("react");
|
|
4
|
+
|
|
5
|
+
exports.useMicrophone = function(startMuted = !0, microphoneDeviceId) {
|
|
6
|
+
const micStream = React.useRef(null), micTrack = React.useRef(null), mutedRef = React.useRef(startMuted), mountedRef = React.useRef(!0), initializedRef = React.useRef(!1), [microphones, setMicrophones] = React.useState([]), [micOptions, setMicOptions] = React.useState([]), [muted, setMuted] = React.useState(startMuted), [isRequesting, setIsRequesting] = React.useState(!1), [error, setError] = React.useState(null), waitForPaint = React.useCallback(() => tslib_es6.__awaiter(this, void 0, void 0, function*() {
|
|
7
|
+
yield new Promise(resolve => {
|
|
8
|
+
requestAnimationFrame(() => resolve());
|
|
9
|
+
});
|
|
10
|
+
}), []), waitForTrackToBecomeActive = React.useCallback(track => tslib_es6.__awaiter(this, void 0, void 0, function*() {
|
|
11
|
+
("live" !== track.readyState || track.muted) && (yield new Promise(resolve => {
|
|
12
|
+
const handleUnmute = () => {
|
|
13
|
+
track.removeEventListener("unmute", handleUnmute), resolve();
|
|
14
|
+
};
|
|
15
|
+
track.addEventListener("unmute", handleUnmute, {
|
|
16
|
+
once: !0
|
|
17
|
+
});
|
|
18
|
+
}));
|
|
19
|
+
}), []), stopMicStream = React.useCallback(() => {
|
|
20
|
+
var _a;
|
|
21
|
+
const tracks = null === (_a = micStream.current) || void 0 === _a ? void 0 : _a.getTracks();
|
|
22
|
+
for (const track of null != tracks ? tracks : []) track.stop();
|
|
23
|
+
micStream.current = null, micTrack.current = null;
|
|
24
|
+
}, []), hasMediaSupport = React.useMemo(() => {
|
|
25
|
+
var _a;
|
|
26
|
+
return "undefined" != typeof navigator && Boolean(null === (_a = navigator.mediaDevices) || void 0 === _a ? void 0 : _a.getUserMedia);
|
|
27
|
+
}, []), getMicTrack = React.useCallback(() => {
|
|
28
|
+
if (!micStream.current) throw new Error("No microphone stream found");
|
|
29
|
+
const audioTrack = micStream.current.getAudioTracks()[0];
|
|
30
|
+
if (!audioTrack) throw new Error("No audio track found");
|
|
31
|
+
return audioTrack;
|
|
32
|
+
}, []), muteMic = React.useCallback(() => (getMicTrack().enabled = !1, mutedRef.current = !0,
|
|
33
|
+
setMuted(!0), !0), [ getMicTrack ]), unmuteMic = React.useCallback(() => (getMicTrack().enabled = !0,
|
|
34
|
+
mutedRef.current = !1, setMuted(!1), !0), [ getMicTrack ]), constraints = React.useCallback((deviceId, usePreferredDevice = !0) => {
|
|
35
|
+
var _a;
|
|
36
|
+
const id = usePreferredDevice ? null !== (_a = null != deviceId ? deviceId : microphoneDeviceId) && void 0 !== _a ? _a : void 0 : deviceId;
|
|
37
|
+
return {
|
|
38
|
+
audio: {
|
|
39
|
+
deviceId: id ? {
|
|
40
|
+
exact: id
|
|
41
|
+
} : void 0
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
}, [ microphoneDeviceId ]), requestStream = React.useCallback((deviceId_1, ...args_1) => tslib_es6.__awaiter(this, [ deviceId_1, ...args_1 ], void 0, function*(deviceId, usePreferredDevice = !0) {
|
|
45
|
+
return micStream.current = yield navigator.mediaDevices.getUserMedia(constraints(deviceId, usePreferredDevice)),
|
|
46
|
+
micTrack.current = getMicTrack(), micTrack.current.enabled = !mutedRef.current,
|
|
47
|
+
mutedRef.current || (yield waitForTrackToBecomeActive(micTrack.current)), micStream.current;
|
|
48
|
+
}), [ constraints, getMicTrack, waitForTrackToBecomeActive ]), requestMicrophone = React.useCallback(() => tslib_es6.__awaiter(this, void 0, void 0, function*() {
|
|
49
|
+
if (setIsRequesting(!0), yield waitForPaint(), !hasMediaSupport) {
|
|
50
|
+
const nextError = new Error("Microphone access is not supported");
|
|
51
|
+
return setError(nextError), mountedRef.current && setIsRequesting(!1), null;
|
|
52
|
+
}
|
|
53
|
+
setError(null), stopMicStream();
|
|
54
|
+
try {
|
|
55
|
+
return yield requestStream();
|
|
56
|
+
} catch (error) {
|
|
57
|
+
if (!(error instanceof DOMException && "OverconstrainedError" === error.name || error instanceof DOMException && "NotFoundError" === error.name)) {
|
|
58
|
+
const nextError = error instanceof Error ? error : new Error("Failed to access microphone");
|
|
59
|
+
throw setError(nextError), nextError;
|
|
60
|
+
}
|
|
61
|
+
return yield requestStream(void 0, !1);
|
|
62
|
+
} finally {
|
|
63
|
+
setIsRequesting(!1);
|
|
64
|
+
}
|
|
65
|
+
}), [ hasMediaSupport, requestStream, stopMicStream, waitForPaint ]), refreshMicrophones = React.useCallback(() => tslib_es6.__awaiter(this, void 0, void 0, function*() {
|
|
66
|
+
if (!hasMediaSupport) return [];
|
|
67
|
+
try {
|
|
68
|
+
const devices = yield navigator.mediaDevices.enumerateDevices(), mics = devices.filter(device => "audioinput" === device.kind), options = mics.map(mic => ({
|
|
69
|
+
value: {
|
|
70
|
+
id: mic.deviceId
|
|
71
|
+
},
|
|
72
|
+
label: mic.label
|
|
73
|
+
}));
|
|
74
|
+
return setMicrophones(mics), setMicOptions(options), devices.filter(device => "audioinput" === device.kind);
|
|
75
|
+
} catch (error) {
|
|
76
|
+
return console.warn("Error getting microphone devices:", error), setMicrophones([]),
|
|
77
|
+
setMicOptions([]), [];
|
|
78
|
+
}
|
|
79
|
+
}), [ hasMediaSupport ]), setMicrophone = React.useCallback(deviceId => tslib_es6.__awaiter(this, void 0, void 0, function*() {
|
|
80
|
+
var _a;
|
|
81
|
+
setIsRequesting(!0), yield waitForPaint();
|
|
82
|
+
const id = "string" == typeof deviceId ? deviceId : null === (_a = deviceId.value) || void 0 === _a ? void 0 : _a.id;
|
|
83
|
+
try {
|
|
84
|
+
setError(null), stopMicStream(), yield requestStream(id, !1);
|
|
85
|
+
} catch (err) {
|
|
86
|
+
setError(err instanceof Error ? err : new Error("Error switching microphone")),
|
|
87
|
+
console.warn("Error switching microphone:", err);
|
|
88
|
+
} finally {
|
|
89
|
+
setIsRequesting(!1);
|
|
90
|
+
}
|
|
91
|
+
}), [ requestStream, stopMicStream, waitForPaint ]), toggleMute = React.useCallback(() => {
|
|
92
|
+
try {
|
|
93
|
+
muted ? unmuteMic() : muteMic();
|
|
94
|
+
} catch (error) {
|
|
95
|
+
return void console.warn("Error toggling microphone mute:", error);
|
|
96
|
+
}
|
|
97
|
+
}, [ muted, unmuteMic, muteMic ]);
|
|
98
|
+
return React.useEffect(() => {
|
|
99
|
+
if (mountedRef.current = !0, hasMediaSupport && !initializedRef.current) return initializedRef.current = !0,
|
|
100
|
+
requestMicrophone().then(() => {
|
|
101
|
+
startMuted && muteMic();
|
|
102
|
+
}).catch(err => {
|
|
103
|
+
console.error("Error accessing microphone:", err);
|
|
104
|
+
}), () => {
|
|
105
|
+
mountedRef.current = !1, stopMicStream();
|
|
106
|
+
};
|
|
107
|
+
}, [ hasMediaSupport, requestMicrophone, startMuted, muteMic, stopMicStream ]),
|
|
108
|
+
React.useEffect(() => {
|
|
109
|
+
var _a;
|
|
110
|
+
if (!hasMediaSupport || !(null === (_a = navigator.mediaDevices) || void 0 === _a ? void 0 : _a.addEventListener)) return;
|
|
111
|
+
refreshMicrophones();
|
|
112
|
+
const handleDeviceChange = () => {
|
|
113
|
+
refreshMicrophones().then(nextMicrophones => {
|
|
114
|
+
var _a;
|
|
115
|
+
const currentDeviceId = null === (_a = micTrack.current) || void 0 === _a ? void 0 : _a.getSettings().deviceId, selectedDeviceId = null != microphoneDeviceId ? microphoneDeviceId : currentDeviceId;
|
|
116
|
+
if (!selectedDeviceId) return;
|
|
117
|
+
nextMicrophones.some(mic => mic.deviceId === selectedDeviceId) || requestMicrophone();
|
|
118
|
+
});
|
|
119
|
+
};
|
|
120
|
+
return navigator.mediaDevices.addEventListener("devicechange", handleDeviceChange),
|
|
121
|
+
() => {
|
|
122
|
+
navigator.mediaDevices.removeEventListener("devicechange", handleDeviceChange);
|
|
123
|
+
};
|
|
124
|
+
}, [ hasMediaSupport, microphoneDeviceId, refreshMicrophones, requestMicrophone ]),
|
|
125
|
+
{
|
|
126
|
+
micStream: micStream,
|
|
127
|
+
micTrack: micTrack,
|
|
128
|
+
muted: muted,
|
|
129
|
+
isSupported: hasMediaSupport,
|
|
130
|
+
isRequesting: isRequesting,
|
|
131
|
+
error: error,
|
|
132
|
+
microphones: microphones,
|
|
133
|
+
micOptions: micOptions,
|
|
134
|
+
requestMicrophone: requestMicrophone,
|
|
135
|
+
stopMicrophone: stopMicStream,
|
|
136
|
+
muteMic: muteMic,
|
|
137
|
+
unmuteMic: unmuteMic,
|
|
138
|
+
toggleMute: toggleMute,
|
|
139
|
+
refreshMicrophones: refreshMicrophones,
|
|
140
|
+
setMicrophone: setMicrophone
|
|
141
|
+
};
|
|
142
|
+
};
|
package/dist/cjs/hooks.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var hooks_useTheme = require("./hooks/useTheme.js"), hooks_useObserveTheme = require("./hooks/useObserveTheme.js"), hooks_useDoubleClick = require("./hooks/useDoubleClick.js"), hooks_useToolTip = require("./hooks/useToolTip.js"), hooks_useKeyboardShortcuts = require("./hooks/useKeyboardShortcuts.js"), hooks_useLastUpdated = require("./hooks/useLastUpdated.js"), hooks_useLocalStore = require("./hooks/useLocalStore.js"), hooks_useMdStreamBuffer = require("./hooks/useMdStreamBuffer.js"), hooks_useWindow = require("./hooks/useWindow.js"), hooks_useObserveResize = require("./hooks/useObserveResize.js");
|
|
3
|
+
var hooks_useTheme = require("./hooks/useTheme.js"), hooks_useObserveTheme = require("./hooks/useObserveTheme.js"), hooks_useDoubleClick = require("./hooks/useDoubleClick.js"), hooks_useToolTip = require("./hooks/useToolTip.js"), hooks_useKeyboardShortcuts = require("./hooks/useKeyboardShortcuts.js"), hooks_useLastUpdated = require("./hooks/useLastUpdated.js"), hooks_useLocalStore = require("./hooks/useLocalStore.js"), hooks_useMdStreamBuffer = require("./hooks/useMdStreamBuffer.js"), hooks_useMicrophone = require("./hooks/useMicrophone.js"), hooks_useAudioRecorder = require("./hooks/useAudioRecorder.js"), hooks_useWindow = require("./hooks/useWindow.js"), hooks_useObserveResize = require("./hooks/useObserveResize.js");
|
|
4
4
|
|
|
5
5
|
require("react"), require("./theme/themes.js"), require("./theme/colors.js"), require("./theme/corners.js"),
|
|
6
6
|
require("./theme/elevations.js"), require("./theme/motion.js"), require("./theme/type.js"),
|
|
@@ -9,7 +9,8 @@ exports.useTheme = hooks_useTheme.useTheme, exports.useObserveTheme = hooks_useO
|
|
|
9
9
|
exports.useDoubleClick = hooks_useDoubleClick.useDoubleClick, exports.useToolTip = hooks_useToolTip.useToolTip,
|
|
10
10
|
exports.useKeyboardShortcuts = hooks_useKeyboardShortcuts.useKeyboardShortcuts,
|
|
11
11
|
exports.useLastUpdated = hooks_useLastUpdated.useLastUpdated, exports.useLocalStore = hooks_useLocalStore.useLocalStore,
|
|
12
|
-
exports.useMDStreamBuffer = hooks_useMdStreamBuffer.useMDStreamBuffer,
|
|
12
|
+
exports.useMDStreamBuffer = hooks_useMdStreamBuffer.useMDStreamBuffer, exports.useMicrophone = hooks_useMicrophone.useMicrophone,
|
|
13
|
+
exports.useAudioRecorder = hooks_useAudioRecorder.useAudioRecorder, Object.defineProperty(exports, "FormFactor", {
|
|
13
14
|
enumerable: !0,
|
|
14
15
|
get: function() {
|
|
15
16
|
return hooks_useWindow.FormFactor;
|
package/dist/cjs/index.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var sharedTypes = require("./chunks/sharedTypes-gCECyn2N.js"), theme_themes = require("./theme/themes.js"), theme_colors = require("./theme/colors.js"), theme_elevations = require("./theme/elevations.js"), theme_motion = require("./theme/motion.js"), hooks_useTheme = require("./hooks/useTheme.js"), hooks_useObserveTheme = require("./hooks/useObserveTheme.js"), hooks_useDoubleClick = require("./hooks/useDoubleClick.js"), hooks_useToolTip = require("./hooks/useToolTip.js"), hooks_useKeyboardShortcuts = require("./hooks/useKeyboardShortcuts.js"), hooks_useLastUpdated = require("./hooks/useLastUpdated.js"), hooks_useLocalStore = require("./hooks/useLocalStore.js"), hooks_useMdStreamBuffer = require("./hooks/useMdStreamBuffer.js"), hooks_useWindow = require("./hooks/useWindow.js"), hooks_useObserveResize = require("./hooks/useObserveResize.js"), Avatar = require("./chunks/Avatar-CUaQ3kN1.js"), AvatarGroup = require("./chunks/AvatarGroup-B3M7o4Hh.js"), Badge = require("./chunks/Badge-CY_DG6cD.js"), IconButton = require("./chunks/IconButton-BUw3YUsI.js"), Camera = require("./chunks/Camera-CLm3aQR8.js"), CheckBox = require("./chunks/CheckBox-DDINn56u.js"), DivInput = require("./chunks/DivInput-DO3Dgbjp.js"), Dot = require("./chunks/Dot-_HCJ3qxd.js"), DrggablePanel = require("./chunks/DrggablePanel-CERavfv3.js"), DropDown = require("./chunks/DropDown-
|
|
3
|
+
var sharedTypes = require("./chunks/sharedTypes-gCECyn2N.js"), theme_themes = require("./theme/themes.js"), theme_colors = require("./theme/colors.js"), theme_elevations = require("./theme/elevations.js"), theme_motion = require("./theme/motion.js"), hooks_useTheme = require("./hooks/useTheme.js"), hooks_useObserveTheme = require("./hooks/useObserveTheme.js"), hooks_useDoubleClick = require("./hooks/useDoubleClick.js"), hooks_useToolTip = require("./hooks/useToolTip.js"), hooks_useKeyboardShortcuts = require("./hooks/useKeyboardShortcuts.js"), hooks_useLastUpdated = require("./hooks/useLastUpdated.js"), hooks_useLocalStore = require("./hooks/useLocalStore.js"), hooks_useMdStreamBuffer = require("./hooks/useMdStreamBuffer.js"), hooks_useMicrophone = require("./hooks/useMicrophone.js"), hooks_useAudioRecorder = require("./hooks/useAudioRecorder.js"), hooks_useWindow = require("./hooks/useWindow.js"), hooks_useObserveResize = require("./hooks/useObserveResize.js"), AudioBubble = require("./chunks/AudioBubble-C8HdYBY8.js"), Avatar = require("./chunks/Avatar-CUaQ3kN1.js"), AvatarGroup = require("./chunks/AvatarGroup-B3M7o4Hh.js"), Badge = require("./chunks/Badge-CY_DG6cD.js"), IconButton = require("./chunks/IconButton-BUw3YUsI.js"), Camera = require("./chunks/Camera-CLm3aQR8.js"), CheckBox = require("./chunks/CheckBox-DDINn56u.js"), DivInput = require("./chunks/DivInput-DO3Dgbjp.js"), Dot = require("./chunks/Dot-_HCJ3qxd.js"), DrggablePanel = require("./chunks/DrggablePanel-CERavfv3.js"), DropDown = require("./chunks/DropDown-Cy2o78yw.js"), ErrorSummary = require("./chunks/ErrorSummary-BfVHS893.js"), Grouper = require("./chunks/Grouper-RYRxazG9.js"), Overlay = require("./chunks/Overlay-BX6vXX9F.js"), _types = require("./chunks/_types-Sa2RAJ2U.js"), Pager = require("./chunks/Pager-BN37VYEC.js"), PromptInput = require("./chunks/PromptInput-D1wP5-uN.js"), ProgressIndicator = require("./chunks/ProgressIndicator-8QZwTSyY.js"), RadioButton = require("./chunks/RadioButton-Cvqum7dU.js"), RadioButtonList = require("./chunks/RadioButtonList-CPHTioGa.js"), Slider = require("./chunks/Slider-CnXBacf-.js"), Spacer = require("./chunks/Spacer-CtxV2Pww.js"), Switch = require("./chunks/Switch-Cbn0ql3B.js"), TabBar = require("./chunks/TabBar-CnD3E-qa.js"), TextArea = require("./chunks/TextArea-CtJi771p.js"), TextField = require("./chunks/TextField-B2u_CZKk.js"), providers_ThemeProvider = require("./providers/ThemeProvider.js"), Tip = require("./chunks/Tip-DAxoyMyA.js"), Toast = require("./chunks/Toast-D2fpwdjF.js"), Button = require("./chunks/Button-DmWbooXb.js"), Chip = require("./chunks/Chip-DRSg6kLh.js"), FileIcon = require("./chunks/FileIcon-xoD-xIme.js"), Icon = require("./chunks/Icon-BB-t50Yt.js"), _types$1 = require("./chunks/_types-BD6txsj1.js"), ButtonBar = require("./chunks/ButtonBar-RSBwFaU-.js"), Label = require("./chunks/Label-NzMpkZo2.js"), UploadArea = require("./chunks/UploadArea-BS2BPuhZ.js");
|
|
4
4
|
|
|
5
5
|
require("./theme/corners.js"), require("./theme/type.js"), require("react"), require("./chunks/tslib.es6-C8dZW5nY.js"),
|
|
6
|
-
require("./chunks/MdStreamBuffer-DObxjnAm.js"), require("react/jsx-runtime"), require("./chunks/
|
|
7
|
-
require("./chunks/
|
|
8
|
-
require("./chunks/
|
|
9
|
-
Object.defineProperty(exports, "ToolTipType", {
|
|
6
|
+
require("./chunks/MdStreamBuffer-DObxjnAm.js"), require("react/jsx-runtime"), require("./chunks/colors-njquvHkx.js"),
|
|
7
|
+
require("./chunks/audioVisualizer-EIfIjWH7.js"), require("./chunks/style-inject.es-CMuL-BfJ.js"),
|
|
8
|
+
require("./chunks/misc-BTF7BCZW.js"), require("motion/react"), require("./chunks/FileList-DjTXjXnK.js"),
|
|
9
|
+
require("./chunks/debounce-BF4i6uIC.js"), Object.defineProperty(exports, "ToolTipType", {
|
|
10
10
|
enumerable: !0,
|
|
11
11
|
get: function() {
|
|
12
12
|
return sharedTypes.ToolTipType;
|
|
@@ -18,13 +18,15 @@ exports.useTheme = hooks_useTheme.useTheme, exports.useObserveTheme = hooks_useO
|
|
|
18
18
|
exports.useDoubleClick = hooks_useDoubleClick.useDoubleClick, exports.useToolTip = hooks_useToolTip.useToolTip,
|
|
19
19
|
exports.useKeyboardShortcuts = hooks_useKeyboardShortcuts.useKeyboardShortcuts,
|
|
20
20
|
exports.useLastUpdated = hooks_useLastUpdated.useLastUpdated, exports.useLocalStore = hooks_useLocalStore.useLocalStore,
|
|
21
|
-
exports.useMDStreamBuffer = hooks_useMdStreamBuffer.useMDStreamBuffer, exports.
|
|
22
|
-
exports.
|
|
23
|
-
exports.
|
|
24
|
-
exports.
|
|
25
|
-
exports.
|
|
26
|
-
exports.
|
|
27
|
-
exports.
|
|
21
|
+
exports.useMDStreamBuffer = hooks_useMdStreamBuffer.useMDStreamBuffer, exports.useMicrophone = hooks_useMicrophone.useMicrophone,
|
|
22
|
+
exports.useAudioRecorder = hooks_useAudioRecorder.useAudioRecorder, exports.useWindow = hooks_useWindow.useWindow,
|
|
23
|
+
exports.useObserveResize = hooks_useObserveResize.useObserveResize, exports.AudioBubble = AudioBubble.AudioBubble,
|
|
24
|
+
exports.Avatar = Avatar.Avatar, exports.AvatarGroup = AvatarGroup.AvatarGroup, exports.Badge = Badge.Badge,
|
|
25
|
+
exports.IconButton = IconButton.IconButton, exports.Camera = Camera.Camera, exports.CheckBox = CheckBox.CheckBox,
|
|
26
|
+
exports.DivInput = DivInput.DivInput, exports.Dot = Dot.Dot, exports.DraggablePanel = DrggablePanel.DraggablePanel,
|
|
27
|
+
exports.DropDown = DropDown.DropDown, exports.ErrorSummary = ErrorSummary.ErrorSummary,
|
|
28
|
+
exports.Grouper = Grouper.Grouper, exports.Overlay = Overlay.Overlay, exports.FlexDiv = _types.FlexDiv,
|
|
29
|
+
Object.defineProperty(exports, "Size", {
|
|
28
30
|
enumerable: !0,
|
|
29
31
|
get: function() {
|
|
30
32
|
return _types.Size;
|
package/dist/cjs/utils/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var misc = require("../chunks/misc-BTF7BCZW.js"), debounce = require("../chunks/debounce-BF4i6uIC.js"), colors = require("../chunks/colors-njquvHkx.js"), IndexedDB = require("../chunks/IndexedDB-BaVmQgkK.js"), MdStreamBuffer = require("../chunks/MdStreamBuffer-DObxjnAm.js"), SSEConnection = require("../chunks/SSEConnection-C-1OzEOp.js"), WSConnection = require("../chunks/WSConnection-DrOC8Z0R.js");
|
|
3
|
+
var misc = require("../chunks/misc-BTF7BCZW.js"), debounce = require("../chunks/debounce-BF4i6uIC.js"), colors = require("../chunks/colors-njquvHkx.js"), IndexedDB = require("../chunks/IndexedDB-BaVmQgkK.js"), audioVisualizer = require("../chunks/audioVisualizer-EIfIjWH7.js"), MdStreamBuffer = require("../chunks/MdStreamBuffer-DObxjnAm.js"), SSEConnection = require("../chunks/SSEConnection-C-1OzEOp.js"), WSConnection = require("../chunks/WSConnection-DrOC8Z0R.js");
|
|
4
4
|
|
|
5
5
|
require("../chunks/tslib.es6-C8dZW5nY.js"), exports.copyToClipboard = misc.copyToClipboard,
|
|
6
6
|
exports.hexToRgb = misc.hexToRgb, exports.debounce = debounce.debounce, exports.addOpacity = colors.addOpacity,
|
|
7
7
|
exports.tintFromColor = colors.tintFromColor, exports.IndexedDB = IndexedDB.IndexedDB,
|
|
8
|
-
exports.
|
|
9
|
-
exports.WSConnection = WSConnection.WSConnection;
|
|
8
|
+
exports.AudioVisualizer = audioVisualizer.AudioVisualizer, exports.MdBuffer = MdStreamBuffer.MdBuffer,
|
|
9
|
+
exports.SSEConnection = SSEConnection.SSEConnection, exports.WSConnection = WSConnection.WSConnection;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var IndexedDB = require("../../chunks/IndexedDB-BaVmQgkK.js"), MdStreamBuffer = require("../../chunks/MdStreamBuffer-DObxjnAm.js"), SSEConnection = require("../../chunks/SSEConnection-C-1OzEOp.js"), WSConnection = require("../../chunks/WSConnection-DrOC8Z0R.js");
|
|
3
|
+
var IndexedDB = require("../../chunks/IndexedDB-BaVmQgkK.js"), audioVisualizer = require("../../chunks/audioVisualizer-EIfIjWH7.js"), MdStreamBuffer = require("../../chunks/MdStreamBuffer-DObxjnAm.js"), SSEConnection = require("../../chunks/SSEConnection-C-1OzEOp.js"), WSConnection = require("../../chunks/WSConnection-DrOC8Z0R.js");
|
|
4
4
|
|
|
5
5
|
require("../../chunks/tslib.es6-C8dZW5nY.js"), exports.IndexedDB = IndexedDB.IndexedDB,
|
|
6
|
-
exports.
|
|
7
|
-
exports.WSConnection = WSConnection.WSConnection;
|
|
6
|
+
exports.AudioVisualizer = audioVisualizer.AudioVisualizer, exports.MdBuffer = MdStreamBuffer.MdBuffer,
|
|
7
|
+
exports.SSEConnection = SSEConnection.SSEConnection, exports.WSConnection = WSConnection.WSConnection;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { a as __rest } from "./tslib.es6-C-olHjXV.mjs";
|
|
2
|
+
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
|
|
5
|
+
import React, { useRef, useState, useMemo, useEffect } from "react";
|
|
6
|
+
|
|
7
|
+
import { useTheme } from "../hooks/useTheme.mjs";
|
|
8
|
+
|
|
9
|
+
import "../theme/colors.mjs";
|
|
10
|
+
|
|
11
|
+
import { a as addOpacity } from "./colors-FQ0uNQcW.mjs";
|
|
12
|
+
|
|
13
|
+
import { A as AudioVisualizer } from "./audioVisualizer-ZgT77nUw.mjs";
|
|
14
|
+
|
|
15
|
+
import "../hooks/useWindow.mjs";
|
|
16
|
+
|
|
17
|
+
import { s as styleInject } from "./style-inject.es-D0BjEaN8.mjs";
|
|
18
|
+
|
|
19
|
+
var css_wrapper = "AudioBubble-module_wrapper__f2yKg flexBox-module_row__z24tF", css_bubble = "AudioBubble-module_bubble__bpPT3 flexBox-module_row__z24tF";
|
|
20
|
+
|
|
21
|
+
styleInject(".flexBox-module_row__z24tF {\n\tdisplay: flex;\n\tjustify-content: center;\n\talign-items: center;\n\tbox-sizing: border-box;\n\tpadding: 0;\n\tmargin: 0;\n}.flexBox-module_rowBetween__5FEvi {\n\tdisplay: flex;\n\tjustify-content: space-between;\n\talign-items: center;\n\tbox-sizing: border-box;\n\tpadding: 0;\n\tmargin: 0;\n}.flexBox-module_rowStart__4tcxS {\n\tdisplay: flex;\n\tjustify-content: flex-start;\n\talign-items: center;\n\tbox-sizing: border-box;\n\tpadding: 0;\n\tmargin: 0;\n}.flexBox-module_rowEnd__rVdVm {\n\tdisplay: flex;\n\tjustify-content: flex-end;\n\talign-items: center;\n\tbox-sizing: border-box;\n\tpadding: 0;\n\tmargin: 0;\n}.flexBox-module_column__ezvMq {\n\tdisplay: flex;\n\tflex-direction: column;\n\tjustify-content: center;\n\talign-items: center;\n\tbox-sizing: border-box;\n\tpadding: 0;\n\tmargin: 0;\n}.flexBox-module_columnStart__C7P44 {\n\tdisplay: flex;\n\tflex-direction: column;\n\tjustify-content: flex-start;\n\talign-items: flex-start;\n\tbox-sizing: border-box;\n\tpadding: 0;\n\tmargin: 0;\n}.flexBox-module_columnStartCenter__PKcrG {\n\tdisplay: flex;\n\tflex-direction: column;\n\tjustify-content: flex-start;\n\talign-items: center;\n\tbox-sizing: border-box;\n\tpadding: 0;\n\tmargin: 0;\n}.flexBox-module_columnBetween__ERfp7 {\n\tdisplay: flex;\n\tflex-direction: column;\n\tjustify-content: space-between;\n\talign-items: center;\n\tbox-sizing: border-box;\n\tpadding: 0;\n\tmargin: 0;\n}.flexBox-module_columnEnd__lLJuc {\n\tdisplay: flex;\n\tflex-direction: column;\n\tjustify-content: flex-end;\n\talign-items: flex-end;\n\tbox-sizing: border-box;\n\tpadding: 0;\n\tmargin: 0;\n}\n\n.AudioBubble-module_wrapper__f2yKg {\n\tmin-height: var(--ab-size);\n\tmin-width: var(--ab-size);\n\theight: var(--ab-size);\n\twidth: var(--ab-size);\n\toverflow: visible;\n\tz-index: var(--elevation-status);\n}\n\n.AudioBubble-module_bubble__bpPT3 {\n\tmin-height: var(--ab-size);\n\tmin-width: var(--ab-size);\n\theight: var(--ab-size);\n\twidth: var(--ab-size);\n\tborder-radius: 100%;\n\tbackground: var(--ab-bg-color);\n\tbox-shadow: var(--ab-box-shadow);\n\ttransition: transform 40ms linear 0s;\n}\n");
|
|
22
|
+
|
|
23
|
+
const AudioBubble = React.memo(props => {
|
|
24
|
+
const lightColor = useTheme().current.colors["core-text-light"], {audioStream: audioStream, playing: playing = !1, size: size = 64, backgroundColor: backgroundColor = lightColor, glow: glow = !0, glowColor: glowColor = addOpacity(lightColor, .1), glowSize: glowSize = 48, glowOffset: glowOffset = 18, minScale: minScale = 1, maxScale: maxScale = 3, intensity: intensity = 2.2, peakIntensity: peakIntensity = .5, risePerSeconds: risePerSeconds = 4, ReleasePerSeconds: ReleasePerSeconds = 1.5} = props, divAttributes = __rest(props, [ "audioStream", "playing", "size", "backgroundColor", "glow", "glowColor", "glowSize", "glowOffset", "minScale", "maxScale", "intensity", "peakIntensity", "risePerSeconds", "ReleasePerSeconds" ]), {id: divId, className: className, style: style} = divAttributes, rest = __rest(divAttributes, [ "id", "className", "style" ]), divStyle = null != style ? style : {}, divClass = className ? ` ${className}` : "", visualizerRef = useRef(null), [scale, setScale] = useState(minScale), visualizerSettings = useMemo(() => ({
|
|
25
|
+
minScale: minScale,
|
|
26
|
+
maxScale: maxScale,
|
|
27
|
+
intensityMultiplier: intensity,
|
|
28
|
+
peakIntensity: peakIntensity,
|
|
29
|
+
risePerSecond: risePerSeconds,
|
|
30
|
+
releasePerSecond: ReleasePerSeconds,
|
|
31
|
+
onUpdate: ({scale: nextScale}) => setScale(nextScale)
|
|
32
|
+
}), [ minScale, maxScale, intensity, peakIntensity, risePerSeconds, ReleasePerSeconds ]), setGlow = useMemo(() => glow ? `0 ${glowOffset}px ${glowSize}px ${glowColor}` : "unset", [ glow, glowColor, glowSize, glowOffset ]), cssVars = useMemo(() => ({
|
|
33
|
+
"--ab-size": `${size}px`,
|
|
34
|
+
"--ab-bg-color": backgroundColor,
|
|
35
|
+
"--ab-box-shadow": setGlow
|
|
36
|
+
}), [ size, backgroundColor, setGlow ]);
|
|
37
|
+
return useEffect(() => {
|
|
38
|
+
var _a;
|
|
39
|
+
if (null === (_a = visualizerRef.current) || void 0 === _a || _a.dispose(), visualizerRef.current = null,
|
|
40
|
+
!audioStream) return void setScale(minScale);
|
|
41
|
+
const visualizer = new AudioVisualizer(audioStream, visualizerSettings);
|
|
42
|
+
return visualizerRef.current = visualizer, playing && visualizer.start(), () => {
|
|
43
|
+
visualizer.dispose(), visualizerRef.current === visualizer && (visualizerRef.current = null);
|
|
44
|
+
};
|
|
45
|
+
}, [ audioStream, minScale, playing, visualizerSettings ]), useEffect(() => {
|
|
46
|
+
visualizerRef.current && (playing ? visualizerRef.current.start() : (visualizerRef.current.stop(),
|
|
47
|
+
setScale(minScale)));
|
|
48
|
+
}, [ minScale, playing ]), jsx("div", Object.assign({
|
|
49
|
+
id: divId,
|
|
50
|
+
className: `${css_wrapper}${divClass}`,
|
|
51
|
+
style: divStyle
|
|
52
|
+
}, rest, {
|
|
53
|
+
children: jsx("div", {
|
|
54
|
+
className: css_bubble,
|
|
55
|
+
style: Object.assign(Object.assign({}, cssVars), {
|
|
56
|
+
transform: `scale(${scale})`
|
|
57
|
+
})
|
|
58
|
+
})
|
|
59
|
+
}));
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
export { AudioBubble as A };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { a as __rest } from "./tslib.es6-C-olHjXV.mjs";
|
|
2
2
|
|
|
3
3
|
import { jsx } from "react/jsx-runtime";
|
|
4
4
|
|
|
5
5
|
import React, { useRef, useState, useMemo, useEffect, useCallback } from "react";
|
|
6
6
|
|
|
7
|
-
import { n as normalizedPercent, a as accessibleKeyDown, s as setStyle } from "./misc-
|
|
7
|
+
import { n as normalizedPercent, a as accessibleKeyDown, s as setStyle } from "./misc-BeEWwOaJ.mjs";
|
|
8
8
|
|
|
9
9
|
import { s as styleInject } from "./style-inject.es-D0BjEaN8.mjs";
|
|
10
10
|
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { a as __rest } from "./tslib.es6-C-olHjXV.mjs";
|
|
2
2
|
|
|
3
3
|
import { jsx } from "react/jsx-runtime";
|
|
4
4
|
|
|
5
5
|
import React, { useMemo } from "react";
|
|
6
6
|
|
|
7
|
-
import { A as Avatar } from "./Avatar-
|
|
7
|
+
import { A as Avatar } from "./Avatar-C8uV7ROZ.mjs";
|
|
8
8
|
|
|
9
9
|
import { s as styleInject } from "./style-inject.es-D0BjEaN8.mjs";
|
|
10
10
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { a as __rest } from "./tslib.es6-C-olHjXV.mjs";
|
|
2
2
|
|
|
3
3
|
import { jsxs, jsx } from "react/jsx-runtime";
|
|
4
4
|
|
|
@@ -6,13 +6,13 @@ import { motion } from "motion/react";
|
|
|
6
6
|
|
|
7
7
|
import React, { forwardRef, useState, useRef, useCallback, useEffect, useImperativeHandle, useMemo } from "react";
|
|
8
8
|
|
|
9
|
-
import { B as Badge } from "./Badge-
|
|
9
|
+
import { B as Badge } from "./Badge-D-U1jomY.mjs";
|
|
10
10
|
|
|
11
|
-
import { D as Dot } from "./Dot-
|
|
11
|
+
import { D as Dot } from "./Dot-Cj6gWj4_.mjs";
|
|
12
12
|
|
|
13
|
-
import { I as Icon } from "./Icon-
|
|
13
|
+
import { I as Icon } from "./Icon-KDwlMXzH.mjs";
|
|
14
14
|
|
|
15
|
-
import { P as ProgressIndicator } from "./ProgressIndicator-
|
|
15
|
+
import { P as ProgressIndicator } from "./ProgressIndicator-CxsZm_As.mjs";
|
|
16
16
|
|
|
17
17
|
import { T as ToolTipType } from "./sharedTypes-tn9-uJvb.mjs";
|
|
18
18
|
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { a as __rest } from "./tslib.es6-C-olHjXV.mjs";
|
|
2
2
|
|
|
3
3
|
import { jsx } from "react/jsx-runtime";
|
|
4
4
|
|
|
5
5
|
import React, { useState, useEffect, useCallback, useMemo, useRef } from "react";
|
|
6
6
|
|
|
7
|
-
import { s as setStyle } from "./misc-
|
|
7
|
+
import { s as setStyle } from "./misc-BeEWwOaJ.mjs";
|
|
8
8
|
|
|
9
|
-
import { I as Icon } from "./Icon-
|
|
9
|
+
import { I as Icon } from "./Icon-KDwlMXzH.mjs";
|
|
10
10
|
|
|
11
11
|
import { s as styleInject } from "./style-inject.es-D0BjEaN8.mjs";
|
|
12
12
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { _ as __awaiter } from "./tslib.es6-C-olHjXV.mjs";
|
|
2
2
|
|
|
3
3
|
import { jsxs, jsx } from "react/jsx-runtime";
|
|
4
4
|
|
|
@@ -8,15 +8,15 @@ import { useTheme } from "../hooks/useTheme.mjs";
|
|
|
8
8
|
|
|
9
9
|
import "../theme/colors.mjs";
|
|
10
10
|
|
|
11
|
-
import { a as accessibleKeyDown } from "./misc-
|
|
11
|
+
import { a as accessibleKeyDown } from "./misc-BeEWwOaJ.mjs";
|
|
12
12
|
|
|
13
13
|
import { a as addOpacity } from "./colors-FQ0uNQcW.mjs";
|
|
14
14
|
|
|
15
15
|
import "../hooks/useWindow.mjs";
|
|
16
16
|
|
|
17
|
-
import { A as Avatar } from "./Avatar-
|
|
17
|
+
import { A as Avatar } from "./Avatar-C8uV7ROZ.mjs";
|
|
18
18
|
|
|
19
|
-
import { I as Icon } from "./Icon-
|
|
19
|
+
import { I as Icon } from "./Icon-KDwlMXzH.mjs";
|
|
20
20
|
|
|
21
21
|
import { s as styleInject } from "./style-inject.es-D0BjEaN8.mjs";
|
|
22
22
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { a as __rest } from "./tslib.es6-C-olHjXV.mjs";
|
|
2
2
|
|
|
3
3
|
import { jsxs, jsx } from "react/jsx-runtime";
|
|
4
4
|
|
|
@@ -6,9 +6,9 @@ import { motion } from "motion/react";
|
|
|
6
6
|
|
|
7
7
|
import React, { useState, useEffect, useMemo, useCallback } from "react";
|
|
8
8
|
|
|
9
|
-
import { a as accessibleKeyDown } from "./misc-
|
|
9
|
+
import { a as accessibleKeyDown } from "./misc-BeEWwOaJ.mjs";
|
|
10
10
|
|
|
11
|
-
import { I as Icon } from "./Icon-
|
|
11
|
+
import { I as Icon } from "./Icon-KDwlMXzH.mjs";
|
|
12
12
|
|
|
13
13
|
import { s as styleInject } from "./style-inject.es-D0BjEaN8.mjs";
|
|
14
14
|
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { a as __rest } from "./tslib.es6-C-olHjXV.mjs";
|
|
2
2
|
|
|
3
3
|
import { jsxs, jsx } from "react/jsx-runtime";
|
|
4
4
|
|
|
5
5
|
import React, { useState, useCallback, useMemo } from "react";
|
|
6
6
|
|
|
7
|
-
import { s as setStyle, a as accessibleKeyDown } from "./misc-
|
|
7
|
+
import { s as setStyle, a as accessibleKeyDown } from "./misc-BeEWwOaJ.mjs";
|
|
8
8
|
|
|
9
|
-
import { I as Icon } from "./Icon-
|
|
9
|
+
import { I as Icon } from "./Icon-KDwlMXzH.mjs";
|
|
10
10
|
|
|
11
11
|
import { T as ToolTipType } from "./sharedTypes-tn9-uJvb.mjs";
|
|
12
12
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { a as __rest } from "./tslib.es6-C-olHjXV.mjs";
|
|
2
2
|
|
|
3
3
|
import { jsx } from "react/jsx-runtime";
|
|
4
4
|
|
|
@@ -6,7 +6,7 @@ import { motion } from "motion/react";
|
|
|
6
6
|
|
|
7
7
|
import React, { useRef, useState, useCallback, useEffect, useMemo } from "react";
|
|
8
8
|
|
|
9
|
-
import { b as cleanString } from "./misc-
|
|
9
|
+
import { b as cleanString } from "./misc-BeEWwOaJ.mjs";
|
|
10
10
|
|
|
11
11
|
import { s as styleInject } from "./style-inject.es-D0BjEaN8.mjs";
|
|
12
12
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { a as __rest } from "./tslib.es6-C-olHjXV.mjs";
|
|
2
2
|
|
|
3
3
|
import { jsxs, jsx } from "react/jsx-runtime";
|
|
4
4
|
|
|
@@ -8,7 +8,7 @@ import { useTheme } from "../hooks/useTheme.mjs";
|
|
|
8
8
|
|
|
9
9
|
import "../theme/colors.mjs";
|
|
10
10
|
|
|
11
|
-
import { p as pointerPosition } from "./misc-
|
|
11
|
+
import { p as pointerPosition } from "./misc-BeEWwOaJ.mjs";
|
|
12
12
|
|
|
13
13
|
import "../hooks/useWindow.mjs";
|
|
14
14
|
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { a as __rest } from "./tslib.es6-C-olHjXV.mjs";
|
|
2
2
|
|
|
3
3
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
4
|
|
|
5
5
|
import React, { useState, useRef, useEffect, useCallback, useMemo } from "react";
|
|
6
6
|
|
|
7
|
-
import { s as setStyle } from "./misc-
|
|
7
|
+
import { s as setStyle } from "./misc-BeEWwOaJ.mjs";
|
|
8
8
|
|
|
9
|
-
import { I as Icon } from "./Icon-
|
|
9
|
+
import { I as Icon } from "./Icon-KDwlMXzH.mjs";
|
|
10
10
|
|
|
11
11
|
import { s as styleInject } from "./style-inject.es-D0BjEaN8.mjs";
|
|
12
12
|
|
|
@@ -27,7 +27,7 @@ function resolveValueKey(value, valueKey) {
|
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
function DropDownComponent(props) {
|
|
30
|
-
const {name: name = "drop-down-select", label: label, labelColor: labelColor = "var(--core-text-primary)", size: size = "m", width: width = "100%", height: height = "auto", selectedIndex: selectedIndex, selectedValue: selectedValue, valueKey: valueKey, options: options = [], placeholder: placeholder = !0, borderRadius: borderRadius = 4, backgroundColor: backgroundColor, bgColor: bgColor = "
|
|
30
|
+
const {name: name = "drop-down-select", label: label, labelColor: labelColor = "var(--core-text-primary)", size: size = "m", width: width = "100%", height: height = "auto", selectedIndex: selectedIndex, selectedValue: selectedValue, valueKey: valueKey, options: options = [], placeholder: placeholder = !0, borderRadius: borderRadius = 4, backgroundColor: backgroundColor = "var(--core-surface-secondary)", bgColor: bgColor = "var(--core-surface-secondary)", iconColor: iconColor = "var(--core-text-primary)", textColor: textColor = "var(--core-text-primary)", borderWidth: borderWidth, borderSize: borderSize = 1, borderColor: borderColor = "var(--core-outline-primary)", paddingLeft: paddingLeft = "8px", paddingRight: paddingRight = "12px", paddingTop: paddingTop = "8px", paddingBottom: paddingBottom = "8px", borderStyle: borderStyle = "box", iconSize: iconSize = 20, disabled: disabled = !1, error: error = !1, gap: gap = 8, onChange: onChange = () => null, onOption: onOption = () => null} = props, divAttributes = __rest(props, [ "name", "label", "labelColor", "size", "width", "height", "selectedIndex", "selectedValue", "valueKey", "options", "placeholder", "borderRadius", "backgroundColor", "bgColor", "iconColor", "textColor", "borderWidth", "borderSize", "borderColor", "paddingLeft", "paddingRight", "paddingTop", "paddingBottom", "borderStyle", "iconSize", "disabled", "error", "gap", "onChange", "onOption" ]), {id: divId, className: className, style: style} = divAttributes, rest = __rest(divAttributes, [ "id", "className", "style" ]), divStyle = null != style ? style : {}, divClass = className ? ` ${className}` : "", resolvedBackgroundColor = null != backgroundColor ? backgroundColor : bgColor, resolvedBorderWidth = null != borderWidth ? borderWidth : borderSize, [index, setIndex] = useState(null != selectedIndex ? selectedIndex : 0), [selectedText, setSelectedText] = useState("Select an option"), ref = useRef(null);
|
|
31
31
|
useEffect(() => {
|
|
32
32
|
if (null == selectedValue && void 0 !== selectedIndex && (null == ref ? void 0 : ref.current)) {
|
|
33
33
|
if (!(null == options ? void 0 : options[selectedIndex])) return;
|
|
@@ -48,8 +48,8 @@ function DropDownComponent(props) {
|
|
|
48
48
|
const handleChange = useCallback(i => {
|
|
49
49
|
if (!options) return;
|
|
50
50
|
const label = options[i].label || "Select an option";
|
|
51
|
-
setIndex(i), setSelectedText(label), index !== i && onChange(i, options[i]);
|
|
52
|
-
}, [ options, index, onChange ]), renderedOptions = useMemo(() => options ? options.map((option, i) => jsx("option", {
|
|
51
|
+
setIndex(i), setSelectedText(label), index !== i && (onChange(i, options[i]), onOption(options[i]));
|
|
52
|
+
}, [ options, index, onChange, onOption ]), renderedOptions = useMemo(() => options ? options.map((option, i) => jsx("option", {
|
|
53
53
|
value: i,
|
|
54
54
|
onMouseUp: () => handleChange(i),
|
|
55
55
|
children: null == option ? void 0 : option.label
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { a as __rest } from "./tslib.es6-C-olHjXV.mjs";
|
|
2
2
|
|
|
3
3
|
import { jsxs, Fragment, jsx } from "react/jsx-runtime";
|
|
4
4
|
|
|
@@ -8,7 +8,7 @@ import { useTheme } from "../hooks/useTheme.mjs";
|
|
|
8
8
|
|
|
9
9
|
import "../theme/colors.mjs";
|
|
10
10
|
|
|
11
|
-
import { a as accessibleKeyDown } from "./misc-
|
|
11
|
+
import { a as accessibleKeyDown } from "./misc-BeEWwOaJ.mjs";
|
|
12
12
|
|
|
13
13
|
import "../hooks/useWindow.mjs";
|
|
14
14
|
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { a as __rest } from "./tslib.es6-C-olHjXV.mjs";
|
|
2
2
|
|
|
3
3
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
4
|
|
|
5
5
|
import React, { useCallback, useMemo } from "react";
|
|
6
6
|
|
|
7
|
-
import { s as setStyle, a as accessibleKeyDown } from "./misc-
|
|
7
|
+
import { s as setStyle, a as accessibleKeyDown } from "./misc-BeEWwOaJ.mjs";
|
|
8
8
|
|
|
9
|
-
import { F as FileIcon } from "./FileIcon-
|
|
9
|
+
import { F as FileIcon } from "./FileIcon-DeW-ZBiv.mjs";
|
|
10
10
|
|
|
11
|
-
import { I as Icon } from "./Icon-
|
|
11
|
+
import { I as Icon } from "./Icon-KDwlMXzH.mjs";
|
|
12
12
|
|
|
13
|
-
import { P as ProgressIndicator } from "./ProgressIndicator-
|
|
13
|
+
import { P as ProgressIndicator } from "./ProgressIndicator-CxsZm_As.mjs";
|
|
14
14
|
|
|
15
15
|
import { s as styleInject } from "./style-inject.es-D0BjEaN8.mjs";
|
|
16
16
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { a as __rest } from "./tslib.es6-C-olHjXV.mjs";
|
|
2
2
|
|
|
3
3
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
4
|
|
|
@@ -12,9 +12,9 @@ import "../theme/colors.mjs";
|
|
|
12
12
|
|
|
13
13
|
import "../hooks/useWindow.mjs";
|
|
14
14
|
|
|
15
|
-
import { B as Badge } from "./Badge-
|
|
15
|
+
import { B as Badge } from "./Badge-D-U1jomY.mjs";
|
|
16
16
|
|
|
17
|
-
import { I as Icon } from "./Icon-
|
|
17
|
+
import { I as Icon } from "./Icon-KDwlMXzH.mjs";
|
|
18
18
|
|
|
19
19
|
import { s as styleInject } from "./style-inject.es-D0BjEaN8.mjs";
|
|
20
20
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { a as __rest } from "./tslib.es6-C-olHjXV.mjs";
|
|
2
2
|
|
|
3
3
|
import { jsxs, Fragment, jsx } from "react/jsx-runtime";
|
|
4
4
|
|
|
@@ -8,7 +8,7 @@ import { useTheme } from "../hooks/useTheme.mjs";
|
|
|
8
8
|
|
|
9
9
|
import "../theme/colors.mjs";
|
|
10
10
|
|
|
11
|
-
import { a as accessibleKeyDown } from "./misc-
|
|
11
|
+
import { a as accessibleKeyDown } from "./misc-BeEWwOaJ.mjs";
|
|
12
12
|
|
|
13
13
|
import "../hooks/useWindow.mjs";
|
|
14
14
|
|