uppy/packages/@uppy/audio/src/AudioSourceSelect.tsx
Mikael Finstad d31c90e443
Run biome check on main (#5896)
this time on main
closes #5891

also: fix a11y tabIndex (key event handler)
2025-08-11 10:06:21 +02:00

32 lines
855 B
TypeScript

export interface AudioSourceSelectProps {
currentDeviceId: string | MediaStreamTrack | null | undefined
audioSources: MediaDeviceInfo[]
onChangeSource: (value: string) => void
}
export default ({
currentDeviceId,
audioSources,
onChangeSource,
}: AudioSourceSelectProps) => {
return (
<div className="uppy-Audio-videoSource">
<select
className="uppy-u-reset uppy-Audio-audioSource-select"
onChange={(event) => {
onChangeSource((event.target as HTMLSelectElement).value)
}}
>
{audioSources.map((audioSource) => (
<option
key={audioSource.deviceId}
value={audioSource.deviceId}
selected={audioSource.deviceId === currentDeviceId}
>
{audioSource.label}
</option>
))}
</select>
</div>
)
}