@moises.ai/design-system 4.15.7 → 4.15.9
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/package.json
CHANGED
|
@@ -23,6 +23,7 @@ export const PreviewCard = forwardRef(function PreviewCard(
|
|
|
23
23
|
autoRepeat = false,
|
|
24
24
|
waveColor = 'rgba(90, 97, 105, 1)',
|
|
25
25
|
progressColor = 'rgba(255, 255, 255, 1)',
|
|
26
|
+
hiddenProgress = false,
|
|
26
27
|
className,
|
|
27
28
|
id,
|
|
28
29
|
tabIndex: tabIndexProp,
|
|
@@ -160,6 +161,9 @@ export const PreviewCard = forwardRef(function PreviewCard(
|
|
|
160
161
|
|
|
161
162
|
if (wavegroup) {
|
|
162
163
|
if (wavegroup.state.active !== waveSurferRef.current) {
|
|
164
|
+
if (hiddenProgress) {
|
|
165
|
+
waveSurferRef.current?.setOptions({ progressColor: waveColor })
|
|
166
|
+
}
|
|
163
167
|
return
|
|
164
168
|
}
|
|
165
169
|
|
|
@@ -168,7 +172,7 @@ export const PreviewCard = forwardRef(function PreviewCard(
|
|
|
168
172
|
isPlaying: false,
|
|
169
173
|
}))
|
|
170
174
|
}
|
|
171
|
-
}, [onPlayStateChange, wavegroup])
|
|
175
|
+
}, [onPlayStateChange, wavegroup, hiddenProgress, waveColor])
|
|
172
176
|
|
|
173
177
|
const onSeeking = useCallback(
|
|
174
178
|
(ws) => {
|
|
@@ -204,8 +208,8 @@ export const PreviewCard = forwardRef(function PreviewCard(
|
|
|
204
208
|
|
|
205
209
|
const seekTime =
|
|
206
210
|
typeof newTime === 'number' ? newTime : (ws.getCurrentTime?.() ?? 0)
|
|
207
|
-
const
|
|
208
|
-
|
|
211
|
+
const previousWasPlaying = Boolean(previousActive?.isPlaying?.())
|
|
212
|
+
const wasPlaying = previousWasPlaying || wavegroup.state.isPlaying
|
|
209
213
|
|
|
210
214
|
pendingSeekTimeRef.current = seekTime
|
|
211
215
|
skipTimeSyncRef.current = true
|
|
@@ -217,6 +221,10 @@ export const PreviewCard = forwardRef(function PreviewCard(
|
|
|
217
221
|
ws.setTime(seekTime)
|
|
218
222
|
previousActive.pause()
|
|
219
223
|
|
|
224
|
+
if (!previousWasPlaying) {
|
|
225
|
+
previousActive.emit?.('pause')
|
|
226
|
+
}
|
|
227
|
+
|
|
220
228
|
if (!isSafari) {
|
|
221
229
|
ws.setOptions({ progressColor })
|
|
222
230
|
}
|
|
@@ -7,7 +7,8 @@ const SAMPLE_AUDIO = {
|
|
|
7
7
|
zuri: 'https://storage.googleapis.com/moises-api-assets/voice/demo_zuri.m4a',
|
|
8
8
|
amy: 'https://storage.googleapis.com/moises-api-assets/voice/demo_amy.m4a',
|
|
9
9
|
rosa: 'https://storage.googleapis.com/moises-api-assets/voice/demo_rosa.m4a',
|
|
10
|
-
aisha:
|
|
10
|
+
aisha:
|
|
11
|
+
'https://storage.googleapis.com/moises-api-assets/voice/demo_aisha.m4a',
|
|
11
12
|
}
|
|
12
13
|
|
|
13
14
|
const PREVIEW_ITEMS = [
|
|
@@ -96,6 +97,7 @@ function PreviewCardGroupStory() {
|
|
|
96
97
|
audio={item.audio}
|
|
97
98
|
selected={selectedId === item.id}
|
|
98
99
|
wavegroup={wavegroup}
|
|
100
|
+
hiddenProgress={true}
|
|
99
101
|
onSelect={() => setSelectedId(item.id)}
|
|
100
102
|
actions={<MoreButton aria-label={`More options for ${item.label}`} />}
|
|
101
103
|
/>
|