react-select-media-devices-modal 0.0.1

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 (3) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +82 -0
  3. package/package.json +39 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2023 Yoshiki Kadoshita
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,82 @@
1
+ # react-select-media-devices-modal
2
+
3
+ A React component library for select media devices.
4
+
5
+ ## Features
6
+
7
+ - Select audio input, audio output, and video input device.
8
+
9
+ ## Installation
10
+
11
+ ```shell
12
+ npm install --save react-select-media-devices-modal
13
+ ```
14
+
15
+ ## Usage
16
+
17
+ ```tsx
18
+ import { useState } from 'react';
19
+ import { SelectMediaDevicesModal } from 'react-select-media-devices-modal';
20
+
21
+ function App() {
22
+ const [modalOpen, setModalOpen] = useState(false);
23
+
24
+ const handleDeviceSelected = (devices) => {
25
+ setModalOpen(false);
26
+ console.log(devices);
27
+ };
28
+
29
+ const handleDeviceSelectCanceled = () => {
30
+ setModalOpen(false);
31
+ };
32
+
33
+ return (
34
+ <div>
35
+ <button onClick={() => setModalOpen((current) => !current)}>Select Device</button>
36
+ <SelectMediaDevicesModal
37
+ isSelectAudioInput
38
+ isSelectAudioOutput
39
+ isSelectVideoInput
40
+ open={modalOpen}
41
+ audioInputDeviceLabel="Audio input device"
42
+ audioOutputDeviceLabel="Audio output device"
43
+ videoInputDeviceLabel="Video input device"
44
+ ConfirmButtonText="Confirm"
45
+ CancelButtonText="Cancel"
46
+ allowOutsideClick={false}
47
+ onDeviceSelected={handleDeviceSelected}
48
+ onDeviceSelectCanceled={handleDeviceSelectCanceled}
49
+ ></SelectMediaDevicesModal>
50
+ </div>
51
+ );
52
+ }
53
+
54
+ export default App;
55
+ ```
56
+
57
+ ## Props
58
+
59
+ ### `SelectMediaDevicesModalProps`
60
+
61
+ | Name | Type | Default | Description |
62
+ | :--- | :--- | :------ | :---------- |
63
+ | isSelectAudioInput | `boolean` | `true` | Flag that select an audio input device or not. |
64
+ | isSelectAudioOutput | `boolean` | `true` | Flag that select an audio output device or not. |
65
+ | isSelectVideoInput | `boolean` | `true` | Flag that select a video input device or not. |
66
+ | open | `boolean` | `false` | Flag that open the modal or not. |
67
+ | audioInputDeviceLabel | `string` | `'audio input device'` | Label for list of audio input devices. |
68
+ | audioOutputDeviceLabel | `string` | `'audio output device'` | Label for list of audio output devices. |
69
+ | videoInputDeviceLabel | `string` | `'video input device'` | Label for list of video input devices. |
70
+ | ConfirmButtonText | `string` | `'Confirm'` | Label for the confirm button. |
71
+ | CancelButtonText | `string` | `'Cancel'` | Label for the cancel button. |
72
+ | allowOutsideClick | `boolean` | `true` | Flag that cancel selection when clicking outside of the modal. |
73
+ | onDeviceSelected | `function` | `(devices: { audioInput?: MediaDeviceInfo; audioOutput?: MediaDeviceInfo; videoInput?: MediaDeviceInfo; }) => void` | Handler function called when devices are selected. |
74
+ | onDeviceSelectCanceled | `function` | `() => void` | Handler function called when selection canceled. |
75
+
76
+ ## LICENSE
77
+
78
+ [MIT](./LICENSE)
79
+
80
+ ## Author
81
+
82
+ [Yoshiki Kadoshita](https://github.com/kadoshita)
package/package.json ADDED
@@ -0,0 +1,39 @@
1
+ {
2
+ "name": "react-select-media-devices-modal",
3
+ "description": "A React component library for select media devices",
4
+ "version": "0.0.1",
5
+ "main": "./dist/react-select-media-devices-modal.umd.js",
6
+ "module": "./dist/react-select-media-devices-modal.mjs",
7
+ "types": "./dist/types/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "import": "./dist/react-select-media-devices-modal.mjs",
11
+ "require": "./dist/react-select-media-devices-modal.umd.js"
12
+ },
13
+ "./dist/style.css": "./dist/style.css"
14
+ },
15
+ "files": [
16
+ "dist"
17
+ ],
18
+ "scripts": {
19
+ "dev": "vite serve example",
20
+ "build": "vite build"
21
+ },
22
+ "dependencies": {
23
+ "react": "^18.2.0",
24
+ "react-dom": "^18.2.0",
25
+ "react-router-dom": "^6.10.0"
26
+ },
27
+ "devDependencies": {
28
+ "@mdx-js/react": "^2.3.0",
29
+ "@rollup/plugin-typescript": "^11.1.0",
30
+ "@types/node": "^18.15.11",
31
+ "@types/react": "^18.0.33",
32
+ "@vitejs/plugin-react": "^3.1.0",
33
+ "rimraf": "^4.4.1",
34
+ "serve": "^14.2.0",
35
+ "vite": "^4.2.1",
36
+ "vite-pages-theme-doc": "^4.0.0",
37
+ "vite-plugin-react-pages": "^4.0.0"
38
+ }
39
+ }