biometry-react-components 1.0.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.
- package/LICENSE +21 -0
- package/README.md +69 -0
- package/dist/DocScan.d.ts +10 -0
- package/dist/FaceCapture.d.ts +10 -0
- package/dist/index.d.ts +23 -0
- package/dist/index.esm.js +376 -0
- package/dist/index.esm.js.map +1 -0
- package/dist/index.js +379 -0
- package/dist/index.js.map +1 -0
- package/package.json +60 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 Biometry Team
|
|
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,69 @@
|
|
|
1
|
+
# biometry-react-components
|
|
2
|
+
|
|
3
|
+
React UI components for capturing high-quality biometric data (face, documents) to facilitate integration with Biometry services.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install biometry-react-components
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Components
|
|
12
|
+
|
|
13
|
+
### DocScan
|
|
14
|
+
|
|
15
|
+
Captures document images with a rectangular guidance overlay.
|
|
16
|
+
|
|
17
|
+
```tsx
|
|
18
|
+
import { DocScan } from 'biometry-react-components';
|
|
19
|
+
|
|
20
|
+
function DocumentCapture() {
|
|
21
|
+
const handleCapture = (file: File) => {
|
|
22
|
+
console.log('Captured document:', file);
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
return <DocScan onCapture={handleCapture} />;
|
|
26
|
+
}
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
#### Props
|
|
30
|
+
|
|
31
|
+
| Prop | Type | Default | Description |
|
|
32
|
+
|------|------|---------|-------------|
|
|
33
|
+
| `onCapture` | `(file: File) => void` | **required** | Callback with captured image file |
|
|
34
|
+
| `rectWidth` | `number` | `640` | Width of camera area |
|
|
35
|
+
| `rectHeight` | `number` | `400` | Height of camera area |
|
|
36
|
+
| `className` | `string` | - | Custom CSS class |
|
|
37
|
+
| `style` | `React.CSSProperties` | - | Custom inline styles |
|
|
38
|
+
| `noShadow` | `boolean` | `false` | Remove shadow and border radius |
|
|
39
|
+
|
|
40
|
+
### FaceCapture
|
|
41
|
+
|
|
42
|
+
Captures facial images with an oval guidance overlay.
|
|
43
|
+
|
|
44
|
+
```tsx
|
|
45
|
+
import { FaceCapture } from 'biometry-react-components';
|
|
46
|
+
|
|
47
|
+
function FaceCapture() {
|
|
48
|
+
const handleCapture = (file: File) => {
|
|
49
|
+
console.log('Captured face:', file);
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
return <FaceCapture onCapture={handleCapture} />;
|
|
53
|
+
}
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
#### Props
|
|
57
|
+
|
|
58
|
+
| Prop | Type | Default | Description |
|
|
59
|
+
|------|------|---------|-------------|
|
|
60
|
+
| `onCapture` | `(file: File) => void` | **required** | Callback with captured image file |
|
|
61
|
+
| `rectWidth` | `number` | `360` | Width of camera area |
|
|
62
|
+
| `rectHeight` | `number` | `576` | Height of camera area |
|
|
63
|
+
| `className` | `string` | - | Custom CSS class |
|
|
64
|
+
| `style` | `React.CSSProperties` | - | Custom inline styles |
|
|
65
|
+
| `noShadow` | `boolean` | `false` | Remove shadow and border radius |
|
|
66
|
+
|
|
67
|
+
## License
|
|
68
|
+
|
|
69
|
+
MIT
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
export interface DocScanProps {
|
|
3
|
+
rectWidth?: number;
|
|
4
|
+
rectHeight?: number;
|
|
5
|
+
onCapture: (file: File) => void;
|
|
6
|
+
className?: string;
|
|
7
|
+
style?: React.CSSProperties;
|
|
8
|
+
noShadow?: boolean;
|
|
9
|
+
}
|
|
10
|
+
export declare const DocScan: React.FC<DocScanProps>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
export interface FaceCaptureProps {
|
|
3
|
+
rectWidth?: number;
|
|
4
|
+
rectHeight?: number;
|
|
5
|
+
onCapture: (file: File) => void;
|
|
6
|
+
className?: string;
|
|
7
|
+
style?: React.CSSProperties;
|
|
8
|
+
noShadow?: boolean;
|
|
9
|
+
}
|
|
10
|
+
export declare const FaceCapture: React.FC<FaceCaptureProps>;
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
interface DocScanProps {
|
|
4
|
+
rectWidth?: number;
|
|
5
|
+
rectHeight?: number;
|
|
6
|
+
onCapture: (file: File) => void;
|
|
7
|
+
className?: string;
|
|
8
|
+
style?: React.CSSProperties;
|
|
9
|
+
noShadow?: boolean;
|
|
10
|
+
}
|
|
11
|
+
declare const DocScan: React.FC<DocScanProps>;
|
|
12
|
+
|
|
13
|
+
interface FaceCaptureProps {
|
|
14
|
+
rectWidth?: number;
|
|
15
|
+
rectHeight?: number;
|
|
16
|
+
onCapture: (file: File) => void;
|
|
17
|
+
className?: string;
|
|
18
|
+
style?: React.CSSProperties;
|
|
19
|
+
noShadow?: boolean;
|
|
20
|
+
}
|
|
21
|
+
declare const FaceCapture: React.FC<FaceCaptureProps>;
|
|
22
|
+
|
|
23
|
+
export { DocScan, FaceCapture };
|
|
@@ -0,0 +1,376 @@
|
|
|
1
|
+
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
2
|
+
import { useState, useRef, useEffect } from 'react';
|
|
3
|
+
|
|
4
|
+
const DocScan = ({ rectWidth = 640, rectHeight = 400, onCapture, className, style, noShadow = false, }) => {
|
|
5
|
+
const [isConfirming, setIsConfirming] = useState(false);
|
|
6
|
+
const [capturedUrl, setCapturedUrl] = useState(null);
|
|
7
|
+
const [capturedFile, setCapturedFile] = useState(null);
|
|
8
|
+
const videoRef = useRef(null);
|
|
9
|
+
const streamRef = useRef(null);
|
|
10
|
+
const QUALITY_MULTIPLIER = 3;
|
|
11
|
+
// Crop area (dashed area) as percentages
|
|
12
|
+
const cropTop = 0.1, cropLeft = 0.1, cropWidth = 0.8, cropHeight = 0.8;
|
|
13
|
+
useEffect(() => {
|
|
14
|
+
let isMounted = true;
|
|
15
|
+
if (!isConfirming) {
|
|
16
|
+
(async () => {
|
|
17
|
+
try {
|
|
18
|
+
const stream = await navigator.mediaDevices.getUserMedia({ video: { width: rectWidth, height: rectHeight } });
|
|
19
|
+
if (videoRef.current && isMounted) {
|
|
20
|
+
videoRef.current.srcObject = stream;
|
|
21
|
+
videoRef.current.onloadedmetadata = () => {
|
|
22
|
+
videoRef.current?.play();
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
streamRef.current = stream;
|
|
26
|
+
}
|
|
27
|
+
catch (err) {
|
|
28
|
+
console.error(err);
|
|
29
|
+
}
|
|
30
|
+
})();
|
|
31
|
+
}
|
|
32
|
+
return () => {
|
|
33
|
+
isMounted = false;
|
|
34
|
+
if (streamRef.current) {
|
|
35
|
+
streamRef.current.getTracks().forEach((track) => track.stop());
|
|
36
|
+
streamRef.current = null;
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
}, [isConfirming, rectWidth, rectHeight]);
|
|
40
|
+
const handleCapture = () => {
|
|
41
|
+
const video = videoRef.current;
|
|
42
|
+
if (!video)
|
|
43
|
+
return;
|
|
44
|
+
const canvas = document.createElement("canvas");
|
|
45
|
+
canvas.width = rectWidth * QUALITY_MULTIPLIER;
|
|
46
|
+
canvas.height = rectHeight * QUALITY_MULTIPLIER;
|
|
47
|
+
const ctx = canvas.getContext("2d");
|
|
48
|
+
if (ctx) {
|
|
49
|
+
// Aspect-ratio crop to fill the output area
|
|
50
|
+
const videoAspect = video.videoWidth / video.videoHeight;
|
|
51
|
+
const targetAspect = rectWidth / rectHeight;
|
|
52
|
+
let sx = 0, sy = 0, sw = video.videoWidth, sh = video.videoHeight;
|
|
53
|
+
if (videoAspect > targetAspect) {
|
|
54
|
+
// Video is wider than target: crop sides
|
|
55
|
+
sw = video.videoHeight * targetAspect;
|
|
56
|
+
sx = (video.videoWidth - sw) / 2;
|
|
57
|
+
}
|
|
58
|
+
else {
|
|
59
|
+
// Video is taller than target: crop top/bottom
|
|
60
|
+
sh = video.videoWidth / targetAspect;
|
|
61
|
+
sy = (video.videoHeight - sh) / 2;
|
|
62
|
+
}
|
|
63
|
+
ctx.drawImage(video, sx, sy, sw, sh, 0, 0, canvas.width, canvas.height);
|
|
64
|
+
canvas.toBlob((blob) => {
|
|
65
|
+
if (blob) {
|
|
66
|
+
const file = new File([blob], "document.jpg", { type: "image/jpeg" });
|
|
67
|
+
setCapturedFile(file);
|
|
68
|
+
setCapturedUrl(URL.createObjectURL(blob));
|
|
69
|
+
setIsConfirming(true);
|
|
70
|
+
}
|
|
71
|
+
}, "image/jpeg", 0.98);
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
const handleConfirm = () => {
|
|
75
|
+
if (capturedFile) {
|
|
76
|
+
onCapture(capturedFile);
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
const handleDecline = () => {
|
|
80
|
+
if (capturedUrl) {
|
|
81
|
+
URL.revokeObjectURL(capturedUrl);
|
|
82
|
+
}
|
|
83
|
+
setCapturedUrl(null);
|
|
84
|
+
setCapturedFile(null);
|
|
85
|
+
setIsConfirming(false);
|
|
86
|
+
};
|
|
87
|
+
const wrapperStyle = {
|
|
88
|
+
background: '#fff',
|
|
89
|
+
borderRadius: noShadow ? 0 : 10,
|
|
90
|
+
boxShadow: noShadow ? undefined : '0 4px 24px rgba(0,0,0,0.12)',
|
|
91
|
+
padding: 20,
|
|
92
|
+
display: 'flex',
|
|
93
|
+
flexDirection: 'column',
|
|
94
|
+
alignItems: 'center',
|
|
95
|
+
justifyContent: 'center',
|
|
96
|
+
width: rectWidth,
|
|
97
|
+
height: rectHeight + 64,
|
|
98
|
+
margin: '0 auto',
|
|
99
|
+
...style,
|
|
100
|
+
};
|
|
101
|
+
const defaultCameraArea = {
|
|
102
|
+
position: 'relative',
|
|
103
|
+
width: rectWidth - 40,
|
|
104
|
+
height: rectHeight - 40,
|
|
105
|
+
marginBottom: 20,
|
|
106
|
+
display: 'flex',
|
|
107
|
+
alignItems: 'center',
|
|
108
|
+
justifyContent: 'center',
|
|
109
|
+
};
|
|
110
|
+
const defaultDashedArea = {
|
|
111
|
+
position: 'absolute',
|
|
112
|
+
top: `${cropTop * 100}%`,
|
|
113
|
+
left: `${cropLeft * 100}%`,
|
|
114
|
+
width: `${cropWidth * 100}%`,
|
|
115
|
+
height: `${cropHeight * 100}%`,
|
|
116
|
+
border: '2.5px dashed #fff',
|
|
117
|
+
borderRadius: 16,
|
|
118
|
+
boxSizing: 'border-box',
|
|
119
|
+
zIndex: 2,
|
|
120
|
+
background: 'transparent',
|
|
121
|
+
display: 'flex',
|
|
122
|
+
flexDirection: 'column',
|
|
123
|
+
alignItems: 'center',
|
|
124
|
+
};
|
|
125
|
+
const defaultGuidanceText = {
|
|
126
|
+
color: '#fff',
|
|
127
|
+
fontSize: 12,
|
|
128
|
+
fontWeight: 400,
|
|
129
|
+
marginTop: 4,
|
|
130
|
+
marginBottom: 0,
|
|
131
|
+
letterSpacing: 0.2,
|
|
132
|
+
textShadow: '0 1px 4px rgba(0,0,0,0.25)',
|
|
133
|
+
userSelect: 'none',
|
|
134
|
+
};
|
|
135
|
+
const defaultCaptureButton = {
|
|
136
|
+
padding: '12px 32px',
|
|
137
|
+
fontSize: 18,
|
|
138
|
+
borderRadius: 8,
|
|
139
|
+
border: 'none',
|
|
140
|
+
background: '#1976d2',
|
|
141
|
+
color: '#fff',
|
|
142
|
+
cursor: 'pointer',
|
|
143
|
+
boxShadow: '0 2px 8px rgba(0,0,0,0.1)',
|
|
144
|
+
transition: 'background 0.2s',
|
|
145
|
+
margin: '0 auto',
|
|
146
|
+
display: 'block',
|
|
147
|
+
};
|
|
148
|
+
const defaultPreview = {
|
|
149
|
+
width: (rectWidth) * cropWidth,
|
|
150
|
+
height: (rectHeight) * cropHeight,
|
|
151
|
+
display: 'flex',
|
|
152
|
+
alignItems: 'center',
|
|
153
|
+
justifyContent: 'center',
|
|
154
|
+
background: '#111',
|
|
155
|
+
borderRadius: 8,
|
|
156
|
+
margin: '0 auto',
|
|
157
|
+
};
|
|
158
|
+
const defaultConfirmText = {
|
|
159
|
+
textAlign: 'center',
|
|
160
|
+
marginTop: 16,
|
|
161
|
+
color: '#111',
|
|
162
|
+
fontSize: 17,
|
|
163
|
+
fontWeight: 500,
|
|
164
|
+
textShadow: '0 1px 4px rgba(255,255,255,0.12)',
|
|
165
|
+
};
|
|
166
|
+
const defaultIconButton = {
|
|
167
|
+
background: 'none',
|
|
168
|
+
border: 'none',
|
|
169
|
+
cursor: 'pointer',
|
|
170
|
+
padding: 8,
|
|
171
|
+
borderRadius: '50%',
|
|
172
|
+
transition: 'background 0.2s',
|
|
173
|
+
margin: '0 8px',
|
|
174
|
+
};
|
|
175
|
+
return (jsx("div", { className: className, style: wrapperStyle, children: !isConfirming ? (jsxs(Fragment, { children: [jsxs("div", { className: "docscan-camera-area", style: defaultCameraArea, children: [jsx("video", { ref: videoRef, width: rectWidth - 40, height: rectHeight - 40, className: "docscan-video", style: {
|
|
176
|
+
width: rectWidth - 40,
|
|
177
|
+
height: rectHeight - 40,
|
|
178
|
+
objectFit: 'cover',
|
|
179
|
+
borderRadius: noShadow ? 0 : 8,
|
|
180
|
+
zIndex: 0,
|
|
181
|
+
}, playsInline: true, muted: true, autoPlay: true }), jsx("div", { className: "docscan-dark-overlay", style: {
|
|
182
|
+
position: 'absolute',
|
|
183
|
+
top: 0,
|
|
184
|
+
left: 0,
|
|
185
|
+
width: '100%',
|
|
186
|
+
height: '100%',
|
|
187
|
+
background: 'rgba(0,0,0,0.4)',
|
|
188
|
+
zIndex: 1,
|
|
189
|
+
borderRadius: noShadow ? 0 : 8,
|
|
190
|
+
} }), jsx("div", { className: "docscan-dashed-area", style: defaultDashedArea, children: jsx("span", { className: "docscan-guidance-text", style: defaultGuidanceText, children: "Place your document here" }) })] }), jsx("button", { type: "button", className: "docscan-capture-btn", style: defaultCaptureButton, onClick: handleCapture, children: "Capture" })] })) : (jsxs(Fragment, { children: [jsx("div", { className: "docscan-preview", style: defaultPreview, children: capturedUrl && (jsx("img", { src: capturedUrl, alt: "Captured document", className: "docscan-preview-img", style: { maxWidth: '100%', maxHeight: '100%', borderRadius: 8 } })) }), jsx("div", { className: "docscan-confirm-text", style: defaultConfirmText, children: "Do you want to use this photo?" }), jsxs("div", { className: "docscan-confirm-btns", style: { display: 'flex', justifyContent: 'center', gap: 32, marginTop: 16, width: '100%' }, children: [jsx("button", { type: "button", "aria-label": "Retake", className: "docscan-icon-btn", style: defaultIconButton, onClick: handleDecline, onMouseOver: e => (e.currentTarget.style.background = 'rgba(211,47,47,0.12)'), onMouseOut: e => (e.currentTarget.style.background = 'none'), children: jsxs("svg", { width: "36", height: "36", viewBox: "0 0 36 36", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [jsx("circle", { cx: "18", cy: "18", r: "18", fill: "#fff", fillOpacity: "0.15" }), jsx("path", { d: "M12 12L24 24", stroke: "#d32f2f", strokeWidth: "3", strokeLinecap: "round" }), jsx("path", { d: "M24 12L12 24", stroke: "#d32f2f", strokeWidth: "3", strokeLinecap: "round" })] }) }), jsx("button", { type: "button", "aria-label": "Confirm", className: "docscan-icon-btn", style: defaultIconButton, onClick: handleConfirm, onMouseOver: e => (e.currentTarget.style.background = 'rgba(56,142,60,0.12)'), onMouseOut: e => (e.currentTarget.style.background = 'none'), children: jsxs("svg", { width: "36", height: "36", viewBox: "0 0 36 36", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [jsx("circle", { cx: "18", cy: "18", r: "18", fill: "#fff", fillOpacity: "0.15" }), jsx("path", { d: "M10 19L16 25L26 13", stroke: "#388e3c", strokeWidth: "3", strokeLinecap: "round", strokeLinejoin: "round" })] }) })] })] })) }));
|
|
191
|
+
};
|
|
192
|
+
|
|
193
|
+
const FaceCapture = ({ rectWidth = 360, rectHeight = 576, onCapture, className, style, noShadow = false, }) => {
|
|
194
|
+
const [isConfirming, setIsConfirming] = useState(false);
|
|
195
|
+
const [capturedUrl, setCapturedUrl] = useState(null);
|
|
196
|
+
const [capturedFile, setCapturedFile] = useState(null);
|
|
197
|
+
const videoRef = useRef(null);
|
|
198
|
+
const streamRef = useRef(null);
|
|
199
|
+
const QUALITY_MULTIPLIER = 3;
|
|
200
|
+
useEffect(() => {
|
|
201
|
+
let isMounted = true;
|
|
202
|
+
if (!isConfirming) {
|
|
203
|
+
(async () => {
|
|
204
|
+
try {
|
|
205
|
+
const stream = await navigator.mediaDevices.getUserMedia({ video: { width: rectWidth, height: rectHeight } });
|
|
206
|
+
if (videoRef.current && isMounted) {
|
|
207
|
+
videoRef.current.srcObject = stream;
|
|
208
|
+
videoRef.current.onloadedmetadata = () => {
|
|
209
|
+
videoRef.current?.play();
|
|
210
|
+
};
|
|
211
|
+
}
|
|
212
|
+
streamRef.current = stream;
|
|
213
|
+
}
|
|
214
|
+
catch (err) {
|
|
215
|
+
console.error(err);
|
|
216
|
+
}
|
|
217
|
+
})();
|
|
218
|
+
}
|
|
219
|
+
return () => {
|
|
220
|
+
isMounted = false;
|
|
221
|
+
if (streamRef.current) {
|
|
222
|
+
streamRef.current.getTracks().forEach((track) => track.stop());
|
|
223
|
+
streamRef.current = null;
|
|
224
|
+
}
|
|
225
|
+
};
|
|
226
|
+
}, [isConfirming, rectWidth, rectHeight]);
|
|
227
|
+
const handleCapture = () => {
|
|
228
|
+
const video = videoRef.current;
|
|
229
|
+
if (!video)
|
|
230
|
+
return;
|
|
231
|
+
const canvas = document.createElement("canvas");
|
|
232
|
+
canvas.width = rectWidth * QUALITY_MULTIPLIER;
|
|
233
|
+
canvas.height = rectHeight * QUALITY_MULTIPLIER;
|
|
234
|
+
const ctx = canvas.getContext("2d");
|
|
235
|
+
if (ctx) {
|
|
236
|
+
ctx.drawImage(video, 0, 0, rectWidth, rectHeight, 0, 0, rectWidth * QUALITY_MULTIPLIER, rectHeight * QUALITY_MULTIPLIER);
|
|
237
|
+
canvas.toBlob((blob) => {
|
|
238
|
+
if (blob) {
|
|
239
|
+
const file = new File([blob], "face.jpg", { type: "image/jpeg" });
|
|
240
|
+
setCapturedFile(file);
|
|
241
|
+
setCapturedUrl(URL.createObjectURL(blob));
|
|
242
|
+
setIsConfirming(true);
|
|
243
|
+
}
|
|
244
|
+
}, "image/jpeg", 0.98);
|
|
245
|
+
}
|
|
246
|
+
};
|
|
247
|
+
const handleConfirm = () => {
|
|
248
|
+
if (capturedFile) {
|
|
249
|
+
onCapture(capturedFile);
|
|
250
|
+
}
|
|
251
|
+
};
|
|
252
|
+
const handleDecline = () => {
|
|
253
|
+
if (capturedUrl) {
|
|
254
|
+
URL.revokeObjectURL(capturedUrl);
|
|
255
|
+
}
|
|
256
|
+
setCapturedUrl(null);
|
|
257
|
+
setCapturedFile(null);
|
|
258
|
+
setIsConfirming(false);
|
|
259
|
+
};
|
|
260
|
+
const wrapperStyle = {
|
|
261
|
+
background: '#fff',
|
|
262
|
+
borderRadius: noShadow ? 0 : 10,
|
|
263
|
+
boxShadow: noShadow ? undefined : '0 4px 24px rgba(0,0,0,0.12)',
|
|
264
|
+
padding: 20,
|
|
265
|
+
display: 'flex',
|
|
266
|
+
flexDirection: 'column',
|
|
267
|
+
alignItems: 'center',
|
|
268
|
+
justifyContent: 'center',
|
|
269
|
+
width: rectWidth,
|
|
270
|
+
height: rectHeight + 64,
|
|
271
|
+
margin: '0 auto',
|
|
272
|
+
...style,
|
|
273
|
+
};
|
|
274
|
+
const cameraArea = {
|
|
275
|
+
position: 'relative',
|
|
276
|
+
width: rectWidth - 40,
|
|
277
|
+
height: rectHeight - 40,
|
|
278
|
+
marginBottom: 20,
|
|
279
|
+
display: 'flex',
|
|
280
|
+
alignItems: 'center',
|
|
281
|
+
justifyContent: 'center',
|
|
282
|
+
};
|
|
283
|
+
const ovalArea = {
|
|
284
|
+
position: 'absolute',
|
|
285
|
+
top: '18%',
|
|
286
|
+
left: '50%',
|
|
287
|
+
transform: 'translateX(-50%)',
|
|
288
|
+
width: '72%',
|
|
289
|
+
height: '68%',
|
|
290
|
+
zIndex: 2,
|
|
291
|
+
display: 'flex',
|
|
292
|
+
flexDirection: 'column',
|
|
293
|
+
alignItems: 'center',
|
|
294
|
+
justifyContent: 'flex-start',
|
|
295
|
+
pointerEvents: 'none',
|
|
296
|
+
};
|
|
297
|
+
const ovalDashed = {
|
|
298
|
+
width: '100%',
|
|
299
|
+
height: '100%',
|
|
300
|
+
border: '2.5px dashed #fff',
|
|
301
|
+
borderRadius: '50%',
|
|
302
|
+
boxSizing: 'border-box',
|
|
303
|
+
background: 'transparent',
|
|
304
|
+
pointerEvents: 'none',
|
|
305
|
+
};
|
|
306
|
+
const guidanceText = {
|
|
307
|
+
color: '#fff',
|
|
308
|
+
fontSize: 12,
|
|
309
|
+
fontWeight: 400,
|
|
310
|
+
marginTop: 0,
|
|
311
|
+
marginBottom: 4,
|
|
312
|
+
letterSpacing: 0.2,
|
|
313
|
+
textShadow: '0 1px 4px rgba(0,0,0,0.25)',
|
|
314
|
+
userSelect: 'none',
|
|
315
|
+
alignSelf: 'center',
|
|
316
|
+
};
|
|
317
|
+
const captureButton = {
|
|
318
|
+
padding: '12px 32px',
|
|
319
|
+
fontSize: 18,
|
|
320
|
+
borderRadius: 8,
|
|
321
|
+
border: 'none',
|
|
322
|
+
background: '#1976d2',
|
|
323
|
+
color: '#fff',
|
|
324
|
+
cursor: 'pointer',
|
|
325
|
+
boxShadow: '0 2px 8px rgba(0,0,0,0.1)',
|
|
326
|
+
transition: 'background 0.2s',
|
|
327
|
+
margin: '0 auto',
|
|
328
|
+
display: 'block',
|
|
329
|
+
};
|
|
330
|
+
const preview = {
|
|
331
|
+
width: rectWidth - 25,
|
|
332
|
+
height: rectHeight - 25,
|
|
333
|
+
display: 'flex',
|
|
334
|
+
alignItems: 'center',
|
|
335
|
+
justifyContent: 'center',
|
|
336
|
+
background: '#111',
|
|
337
|
+
borderRadius: 8,
|
|
338
|
+
margin: '0 auto',
|
|
339
|
+
};
|
|
340
|
+
const confirmText = {
|
|
341
|
+
textAlign: 'center',
|
|
342
|
+
marginTop: 16,
|
|
343
|
+
color: '#111',
|
|
344
|
+
fontSize: 17,
|
|
345
|
+
fontWeight: 500,
|
|
346
|
+
textShadow: '0 1px 4px rgba(255,255,255,0.12)',
|
|
347
|
+
};
|
|
348
|
+
const iconButton = {
|
|
349
|
+
background: 'none',
|
|
350
|
+
border: 'none',
|
|
351
|
+
cursor: 'pointer',
|
|
352
|
+
padding: 8,
|
|
353
|
+
borderRadius: '50%',
|
|
354
|
+
transition: 'background 0.2s',
|
|
355
|
+
margin: '0 8px',
|
|
356
|
+
};
|
|
357
|
+
return (jsx("div", { className: className, style: wrapperStyle, children: !isConfirming ? (jsxs(Fragment, { children: [jsxs("div", { className: "facecapture-camera-area", style: cameraArea, children: [jsx("video", { ref: videoRef, width: rectWidth - 40, height: rectHeight - 40, className: "facecapture-video", style: {
|
|
358
|
+
width: rectWidth - 40,
|
|
359
|
+
height: rectHeight - 40,
|
|
360
|
+
objectFit: 'cover',
|
|
361
|
+
borderRadius: noShadow ? 0 : 8,
|
|
362
|
+
zIndex: 0,
|
|
363
|
+
}, playsInline: true, muted: true, autoPlay: true }), jsx("div", { className: "facecapture-dark-overlay", style: {
|
|
364
|
+
position: 'absolute',
|
|
365
|
+
top: 0,
|
|
366
|
+
left: 0,
|
|
367
|
+
width: '100%',
|
|
368
|
+
height: '100%',
|
|
369
|
+
background: 'rgba(0,0,0,0.4)',
|
|
370
|
+
zIndex: 1,
|
|
371
|
+
borderRadius: noShadow ? 0 : 8,
|
|
372
|
+
} }), jsxs("div", { className: "facecapture-oval-area", style: ovalArea, children: [jsx("span", { className: "facecapture-guidance-text", style: guidanceText, children: "Place your face in the oval" }), jsx("div", { className: "facecapture-oval-dashed", style: ovalDashed })] })] }), jsx("button", { type: "button", className: "facecapture-capture-btn", style: captureButton, onClick: handleCapture, children: "Capture" })] })) : (jsxs(Fragment, { children: [jsx("div", { className: "facecapture-preview", style: preview, children: capturedUrl && (jsx("img", { src: capturedUrl, alt: "Captured face", className: "facecapture-preview-img", style: { maxWidth: '100%', maxHeight: '100%', borderRadius: 8 } })) }), jsx("div", { className: "facecapture-confirm-text", style: confirmText, children: "Do you want to use this photo?" }), jsxs("div", { className: "facecapture-confirm-btns", style: { display: 'flex', justifyContent: 'center', gap: 32, marginTop: 16, width: '100%' }, children: [jsx("button", { type: "button", "aria-label": "Retake", className: "facecapture-icon-btn", style: iconButton, onClick: handleDecline, onMouseOver: e => (e.currentTarget.style.background = 'rgba(211,47,47,0.12)'), onMouseOut: e => (e.currentTarget.style.background = 'none'), children: jsxs("svg", { width: "36", height: "36", viewBox: "0 0 36 36", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [jsx("circle", { cx: "18", cy: "18", r: "18", fill: "#fff", fillOpacity: "0.15" }), jsx("path", { d: "M12 12L24 24", stroke: "#d32f2f", strokeWidth: "3", strokeLinecap: "round" }), jsx("path", { d: "M24 12L12 24", stroke: "#d32f2f", strokeWidth: "3", strokeLinecap: "round" })] }) }), jsx("button", { type: "button", "aria-label": "Confirm", className: "facecapture-icon-btn", style: iconButton, onClick: handleConfirm, onMouseOver: e => (e.currentTarget.style.background = 'rgba(56,142,60,0.12)'), onMouseOut: e => (e.currentTarget.style.background = 'none'), children: jsxs("svg", { width: "36", height: "36", viewBox: "0 0 36 36", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [jsx("circle", { cx: "18", cy: "18", r: "18", fill: "#fff", fillOpacity: "0.15" }), jsx("path", { d: "M10 19L16 25L26 13", stroke: "#388e3c", strokeWidth: "3", strokeLinecap: "round", strokeLinejoin: "round" })] }) })] })] })) }));
|
|
373
|
+
};
|
|
374
|
+
|
|
375
|
+
export { DocScan, FaceCapture };
|
|
376
|
+
//# sourceMappingURL=index.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.esm.js","sources":["../src/DocScan.tsx","../src/FaceCapture.tsx"],"sourcesContent":["import React, { useState, useRef, useEffect } from \"react\";\n\nexport interface DocScanProps {\n rectWidth?: number;\n rectHeight?: number;\n onCapture: (file: File) => void;\n className?: string;\n style?: React.CSSProperties;\n noShadow?: boolean;\n}\n\nexport const DocScan: React.FC<DocScanProps> = ({\n rectWidth = 640,\n rectHeight = 400,\n onCapture,\n className,\n style,\n noShadow = false,\n}) => {\n const [isConfirming, setIsConfirming] = useState(false);\n const [capturedUrl, setCapturedUrl] = useState<string | null>(null);\n const [capturedFile, setCapturedFile] = useState<File | null>(null);\n const videoRef = useRef<HTMLVideoElement>(null);\n const streamRef = useRef<MediaStream | null>(null);\n\n const QUALITY_MULTIPLIER = 3;\n\n // Crop area (dashed area) as percentages\n const cropTop = 0.1, cropLeft = 0.1, cropWidth = 0.8, cropHeight = 0.8;\n\n useEffect(() => {\n let isMounted = true;\n if (!isConfirming) {\n (async () => {\n try {\n const stream = await navigator.mediaDevices.getUserMedia({ video: { width: rectWidth, height: rectHeight } });\n if (videoRef.current && isMounted) {\n videoRef.current.srcObject = stream;\n videoRef.current.onloadedmetadata = () => {\n videoRef.current?.play();\n };\n }\n streamRef.current = stream;\n } catch (err) {\n console.error(err);\n }\n })();\n }\n return () => {\n isMounted = false;\n if (streamRef.current) {\n streamRef.current.getTracks().forEach((track) => track.stop());\n streamRef.current = null;\n }\n };\n }, [isConfirming, rectWidth, rectHeight]);\n\n const handleCapture = () => {\n const video = videoRef.current;\n if (!video) return;\n const canvas = document.createElement(\"canvas\");\n canvas.width = rectWidth * QUALITY_MULTIPLIER;\n canvas.height = rectHeight * QUALITY_MULTIPLIER;\n const ctx = canvas.getContext(\"2d\");\n if (ctx) {\n // Aspect-ratio crop to fill the output area\n const videoAspect = video.videoWidth / video.videoHeight;\n const targetAspect = rectWidth / rectHeight;\n let sx = 0, sy = 0, sw = video.videoWidth, sh = video.videoHeight;\n if (videoAspect > targetAspect) {\n // Video is wider than target: crop sides\n sw = video.videoHeight * targetAspect;\n sx = (video.videoWidth - sw) / 2;\n } else {\n // Video is taller than target: crop top/bottom\n sh = video.videoWidth / targetAspect;\n sy = (video.videoHeight - sh) / 2;\n }\n ctx.drawImage(\n video,\n sx, sy, sw, sh,\n 0, 0,\n canvas.width, canvas.height\n );\n canvas.toBlob((blob) => {\n if (blob) {\n const file = new File([blob], \"document.jpg\", { type: \"image/jpeg\" });\n setCapturedFile(file);\n setCapturedUrl(URL.createObjectURL(blob));\n setIsConfirming(true);\n }\n }, \"image/jpeg\", 0.98);\n }\n };\n\n const handleConfirm = () => {\n if (capturedFile) {\n onCapture(capturedFile);\n }\n };\n\n const handleDecline = () => {\n if (capturedUrl) {\n URL.revokeObjectURL(capturedUrl);\n }\n setCapturedUrl(null);\n setCapturedFile(null);\n setIsConfirming(false);\n };\n\n const wrapperStyle: React.CSSProperties = {\n background: '#fff',\n borderRadius: noShadow ? 0 : 10,\n boxShadow: noShadow ? undefined : '0 4px 24px rgba(0,0,0,0.12)',\n padding: 20,\n display: 'flex',\n flexDirection: 'column',\n alignItems: 'center',\n justifyContent: 'center',\n width: rectWidth,\n height: rectHeight + 64,\n margin: '0 auto',\n ...style,\n };\n\n const defaultCameraArea = {\n position: 'relative',\n width: rectWidth - 40,\n height: rectHeight - 40,\n marginBottom: 20,\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n };\n const defaultDashedArea = {\n position: 'absolute',\n top: `${cropTop * 100}%`,\n left: `${cropLeft * 100}%`,\n width: `${cropWidth * 100}%`,\n height: `${cropHeight * 100}%`,\n border: '2.5px dashed #fff',\n borderRadius: 16,\n boxSizing: 'border-box',\n zIndex: 2,\n background: 'transparent',\n display: 'flex',\n flexDirection: 'column',\n alignItems: 'center',\n };\n const defaultGuidanceText = {\n color: '#fff',\n fontSize: 12,\n fontWeight: 400,\n marginTop: 4,\n marginBottom: 0,\n letterSpacing: 0.2,\n textShadow: '0 1px 4px rgba(0,0,0,0.25)',\n userSelect: 'none',\n };\n const defaultCaptureButton = {\n padding: '12px 32px',\n fontSize: 18,\n borderRadius: 8,\n border: 'none',\n background: '#1976d2',\n color: '#fff',\n cursor: 'pointer',\n boxShadow: '0 2px 8px rgba(0,0,0,0.1)',\n transition: 'background 0.2s',\n margin: '0 auto',\n display: 'block',\n };\n const defaultPreview = {\n width: (rectWidth) * cropWidth,\n height: (rectHeight) * cropHeight,\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n background: '#111',\n borderRadius: 8,\n margin: '0 auto',\n };\n const defaultConfirmText = {\n textAlign: 'center',\n marginTop: 16,\n color: '#111',\n fontSize: 17,\n fontWeight: 500,\n textShadow: '0 1px 4px rgba(255,255,255,0.12)',\n };\n const defaultIconButton = {\n background: 'none',\n border: 'none',\n cursor: 'pointer',\n padding: 8,\n borderRadius: '50%',\n transition: 'background 0.2s',\n margin: '0 8px',\n };\n\n return (\n <div className={className} style={wrapperStyle}>\n {!isConfirming ? (\n <>\n <div className=\"docscan-camera-area\" style={defaultCameraArea as React.CSSProperties}>\n <video\n ref={videoRef}\n width={rectWidth - 40}\n height={rectHeight - 40}\n className=\"docscan-video\"\n style={{\n width: rectWidth - 40,\n height: rectHeight - 40,\n objectFit: 'cover',\n borderRadius: noShadow ? 0 : 8,\n zIndex: 0,\n }}\n playsInline\n muted\n autoPlay\n />\n <div\n className=\"docscan-dark-overlay\"\n style={{\n position: 'absolute' as const,\n top: 0,\n left: 0,\n width: '100%',\n height: '100%',\n background: 'rgba(0,0,0,0.4)',\n zIndex: 1,\n borderRadius: noShadow ? 0 : 8,\n }}\n />\n <div\n className=\"docscan-dashed-area\"\n style={defaultDashedArea as React.CSSProperties}\n >\n <span\n className=\"docscan-guidance-text\"\n style={defaultGuidanceText as React.CSSProperties}\n >\n Place your document here\n </span>\n </div>\n </div> \n <button\n type=\"button\"\n className=\"docscan-capture-btn\"\n style={defaultCaptureButton as React.CSSProperties}\n onClick={handleCapture}\n >\n Capture\n </button>\n </>\n ) : (\n <>\n <div\n className=\"docscan-preview\"\n style={defaultPreview as React.CSSProperties}\n >\n {capturedUrl && (\n <img\n src={capturedUrl}\n alt=\"Captured document\"\n className=\"docscan-preview-img\"\n style={{ maxWidth: '100%', maxHeight: '100%', borderRadius: 8 }}\n />\n )}\n </div>\n <div\n className=\"docscan-confirm-text\"\n style={defaultConfirmText as React.CSSProperties}\n >\n Do you want to use this photo?\n </div>\n <div className=\"docscan-confirm-btns\" style={{ display: 'flex', justifyContent: 'center', gap: 32, marginTop: 16, width: '100%' }}>\n <button\n type=\"button\"\n aria-label=\"Retake\"\n className=\"docscan-icon-btn\"\n style={defaultIconButton as React.CSSProperties}\n onClick={handleDecline}\n onMouseOver={e => (e.currentTarget.style.background = 'rgba(211,47,47,0.12)')}\n onMouseOut={e => (e.currentTarget.style.background = 'none')}\n >\n <svg width=\"36\" height=\"36\" viewBox=\"0 0 36 36\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <circle cx=\"18\" cy=\"18\" r=\"18\" fill=\"#fff\" fillOpacity=\"0.15\" />\n <path d=\"M12 12L24 24\" stroke=\"#d32f2f\" strokeWidth=\"3\" strokeLinecap=\"round\" />\n <path d=\"M24 12L12 24\" stroke=\"#d32f2f\" strokeWidth=\"3\" strokeLinecap=\"round\" />\n </svg>\n </button>\n <button\n type=\"button\"\n aria-label=\"Confirm\"\n className=\"docscan-icon-btn\"\n style={defaultIconButton as React.CSSProperties}\n onClick={handleConfirm}\n onMouseOver={e => (e.currentTarget.style.background = 'rgba(56,142,60,0.12)')}\n onMouseOut={e => (e.currentTarget.style.background = 'none')}\n >\n <svg width=\"36\" height=\"36\" viewBox=\"0 0 36 36\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <circle cx=\"18\" cy=\"18\" r=\"18\" fill=\"#fff\" fillOpacity=\"0.15\" />\n <path d=\"M10 19L16 25L26 13\" stroke=\"#388e3c\" strokeWidth=\"3\" strokeLinecap=\"round\" strokeLinejoin=\"round\" />\n </svg>\n </button>\n </div>\n </>\n )}\n </div>\n );\n}; ","import React, { useState, useRef, useEffect } from \"react\";\n\nexport interface FaceCaptureProps {\n rectWidth?: number;\n rectHeight?: number;\n onCapture: (file: File) => void;\n className?: string;\n style?: React.CSSProperties;\n noShadow?: boolean;\n}\n\nexport const FaceCapture: React.FC<FaceCaptureProps> = ({\n rectWidth = 360,\n rectHeight = 576,\n onCapture,\n className,\n style,\n noShadow = false,\n}) => {\n const [isConfirming, setIsConfirming] = useState(false);\n const [capturedUrl, setCapturedUrl] = useState<string | null>(null);\n const [capturedFile, setCapturedFile] = useState<File | null>(null);\n const videoRef = useRef<HTMLVideoElement>(null);\n const streamRef = useRef<MediaStream | null>(null);\n\n const QUALITY_MULTIPLIER = 3;\n\n useEffect(() => {\n let isMounted = true; \n if (!isConfirming) {\n (async () => {\n try {\n const stream = await navigator.mediaDevices.getUserMedia({ video: { width: rectWidth, height: rectHeight } });\n if (videoRef.current && isMounted) {\n videoRef.current.srcObject = stream;\n videoRef.current.onloadedmetadata = () => {\n videoRef.current?.play();\n };\n }\n streamRef.current = stream;\n } catch (err) {\n console.error(err);\n }\n })();\n }\n return () => {\n isMounted = false;\n if (streamRef.current) {\n streamRef.current.getTracks().forEach((track) => track.stop());\n streamRef.current = null;\n }\n };\n }, [isConfirming, rectWidth, rectHeight]);\n\n const handleCapture = () => {\n const video = videoRef.current;\n if (!video) return;\n const canvas = document.createElement(\"canvas\");\n canvas.width = rectWidth * QUALITY_MULTIPLIER;\n canvas.height = rectHeight * QUALITY_MULTIPLIER;\n const ctx = canvas.getContext(\"2d\");\n if (ctx) {\n ctx.drawImage(\n video,\n 0,\n 0,\n rectWidth,\n rectHeight,\n 0,\n 0,\n rectWidth * QUALITY_MULTIPLIER,\n rectHeight * QUALITY_MULTIPLIER\n );\n canvas.toBlob((blob) => {\n if (blob) {\n const file = new File([blob], \"face.jpg\", { type: \"image/jpeg\" });\n setCapturedFile(file);\n setCapturedUrl(URL.createObjectURL(blob));\n setIsConfirming(true);\n }\n }, \"image/jpeg\", 0.98);\n }\n };\n\n const handleConfirm = () => {\n if (capturedFile) {\n onCapture(capturedFile);\n }\n };\n\n const handleDecline = () => {\n if (capturedUrl) {\n URL.revokeObjectURL(capturedUrl);\n }\n setCapturedUrl(null);\n setCapturedFile(null);\n setIsConfirming(false);\n };\n\n const wrapperStyle: React.CSSProperties = {\n background: '#fff',\n borderRadius: noShadow ? 0 : 10,\n boxShadow: noShadow ? undefined : '0 4px 24px rgba(0,0,0,0.12)',\n padding: 20,\n display: 'flex',\n flexDirection: 'column',\n alignItems: 'center',\n justifyContent: 'center',\n width: rectWidth,\n height: rectHeight + 64,\n margin: '0 auto',\n ...style,\n };\n const cameraArea = {\n position: 'relative' as const,\n width: rectWidth - 40,\n height: rectHeight - 40,\n marginBottom: 20,\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n } as React.CSSProperties;\n const ovalArea = {\n position: 'absolute' as const,\n top: '18%',\n left: '50%',\n transform: 'translateX(-50%)',\n width: '72%',\n height: '68%',\n zIndex: 2,\n display: 'flex',\n flexDirection: 'column' as React.CSSProperties['flexDirection'],\n alignItems: 'center',\n justifyContent: 'flex-start',\n pointerEvents: 'none' as React.CSSProperties['pointerEvents'],\n } as React.CSSProperties;\n const ovalDashed = {\n width: '100%',\n height: '100%',\n border: '2.5px dashed #fff',\n borderRadius: '50%',\n boxSizing: 'border-box' as React.CSSProperties['boxSizing'],\n background: 'transparent',\n pointerEvents: 'none' as React.CSSProperties['pointerEvents'],\n } as React.CSSProperties;\n const guidanceText = {\n color: '#fff',\n fontSize: 12,\n fontWeight: 400,\n marginTop: 0,\n marginBottom: 4,\n letterSpacing: 0.2,\n textShadow: '0 1px 4px rgba(0,0,0,0.25)',\n userSelect: 'none' as React.CSSProperties['userSelect'],\n alignSelf: 'center',\n } as React.CSSProperties;\n const captureButton = {\n padding: '12px 32px',\n fontSize: 18,\n borderRadius: 8,\n border: 'none',\n background: '#1976d2',\n color: '#fff',\n cursor: 'pointer',\n boxShadow: '0 2px 8px rgba(0,0,0,0.1)',\n transition: 'background 0.2s',\n margin: '0 auto',\n display: 'block',\n };\n const preview = {\n width: rectWidth - 25,\n height: rectHeight - 25,\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n background: '#111',\n borderRadius: 8,\n margin: '0 auto',\n };\n const confirmText = {\n textAlign: 'center' as const,\n marginTop: 16,\n color: '#111',\n fontSize: 17,\n fontWeight: 500,\n textShadow: '0 1px 4px rgba(255,255,255,0.12)',\n };\n const iconButton = {\n background: 'none',\n border: 'none',\n cursor: 'pointer',\n padding: 8,\n borderRadius: '50%',\n transition: 'background 0.2s',\n margin: '0 8px',\n };\n\n return (\n <div className={className} style={wrapperStyle}>\n {!isConfirming ? (\n <>\n <div className=\"facecapture-camera-area\" style={cameraArea}>\n <video\n ref={videoRef}\n width={rectWidth - 40}\n height={rectHeight - 40}\n className=\"facecapture-video\"\n style={{\n width: rectWidth - 40,\n height: rectHeight - 40,\n objectFit: 'cover',\n borderRadius: noShadow ? 0 : 8,\n zIndex: 0,\n }}\n playsInline\n muted\n autoPlay\n />\n <div\n className=\"facecapture-dark-overlay\"\n style={{\n position: 'absolute' as const,\n top: 0,\n left: 0,\n width: '100%',\n height: '100%',\n background: 'rgba(0,0,0,0.4)',\n zIndex: 1,\n borderRadius: noShadow ? 0 : 8,\n }}\n />\n <div className=\"facecapture-oval-area\" style={ovalArea}>\n <span className=\"facecapture-guidance-text\" style={guidanceText}>\n Place your face in the oval\n </span>\n <div className=\"facecapture-oval-dashed\" style={ovalDashed}></div>\n </div>\n </div>\n <button\n type=\"button\"\n className=\"facecapture-capture-btn\"\n style={captureButton}\n onClick={handleCapture}\n >\n Capture\n </button>\n </>\n ) : (\n <>\n <div className=\"facecapture-preview\" style={preview}>\n {capturedUrl && (\n <img\n src={capturedUrl}\n alt=\"Captured face\"\n className=\"facecapture-preview-img\"\n style={{ maxWidth: '100%', maxHeight: '100%', borderRadius: 8 }}\n />\n )}\n </div>\n <div className=\"facecapture-confirm-text\" style={confirmText}>\n Do you want to use this photo?\n </div>\n <div className=\"facecapture-confirm-btns\" style={{ display: 'flex', justifyContent: 'center', gap: 32, marginTop: 16, width: '100%' }}>\n <button\n type=\"button\"\n aria-label=\"Retake\"\n className=\"facecapture-icon-btn\"\n style={iconButton}\n onClick={handleDecline}\n onMouseOver={e => (e.currentTarget.style.background = 'rgba(211,47,47,0.12)')}\n onMouseOut={e => (e.currentTarget.style.background = 'none')}\n >\n <svg width=\"36\" height=\"36\" viewBox=\"0 0 36 36\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <circle cx=\"18\" cy=\"18\" r=\"18\" fill=\"#fff\" fillOpacity=\"0.15\" />\n <path d=\"M12 12L24 24\" stroke=\"#d32f2f\" strokeWidth=\"3\" strokeLinecap=\"round\" />\n <path d=\"M24 12L12 24\" stroke=\"#d32f2f\" strokeWidth=\"3\" strokeLinecap=\"round\" />\n </svg>\n </button>\n <button\n type=\"button\"\n aria-label=\"Confirm\"\n className=\"facecapture-icon-btn\"\n style={iconButton}\n onClick={handleConfirm}\n onMouseOver={e => (e.currentTarget.style.background = 'rgba(56,142,60,0.12)')}\n onMouseOut={e => (e.currentTarget.style.background = 'none')}\n >\n <svg width=\"36\" height=\"36\" viewBox=\"0 0 36 36\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <circle cx=\"18\" cy=\"18\" r=\"18\" fill=\"#fff\" fillOpacity=\"0.15\" />\n <path d=\"M10 19L16 25L26 13\" stroke=\"#388e3c\" strokeWidth=\"3\" strokeLinecap=\"round\" strokeLinejoin=\"round\" />\n </svg>\n </button>\n </div>\n </>\n )}\n </div>\n );\n}; "],"names":["_jsx","_jsxs","_Fragment"],"mappings":";;;AAWO,MAAM,OAAO,GAA2B,CAAC,EAC9C,SAAS,GAAG,GAAG,EACf,UAAU,GAAG,GAAG,EAChB,SAAS,EACT,SAAS,EACT,KAAK,EACL,QAAQ,GAAG,KAAK,GACjB,KAAI;IACH,MAAM,CAAC,YAAY,EAAE,eAAe,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC;IACvD,MAAM,CAAC,WAAW,EAAE,cAAc,CAAC,GAAG,QAAQ,CAAgB,IAAI,CAAC;IACnE,MAAM,CAAC,YAAY,EAAE,eAAe,CAAC,GAAG,QAAQ,CAAc,IAAI,CAAC;AACnE,IAAA,MAAM,QAAQ,GAAG,MAAM,CAAmB,IAAI,CAAC;AAC/C,IAAA,MAAM,SAAS,GAAG,MAAM,CAAqB,IAAI,CAAC;IAElD,MAAM,kBAAkB,GAAG,CAAC;;AAG5B,IAAA,MAAM,OAAO,GAAG,GAAG,EAAE,QAAQ,GAAG,GAAG,EAAE,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AAK,CAAC,UAAU,GAAG,MAAM,CAAC,YAE5DC,IAAA,CAAA,KAAA,EAAA,EAAK,KAAK,EAAC,IAAI,EAAC,MAAM,EAAC,IAAI,EAAC,OAAO,EAAC,WAAW,EAAC,IAAI,EAAC,MAAM,EAAC,KAAK,EAAC,4BAA4B,EAAA,QAAA,EAAA,CAC5FD,GAAA,CAAA,QAAA,EAAA,EAAQ,EAAE,EAAC,IAAI,EAAC,EAAE,EAAC,IAAI,EAAC,CAAC,EAAC,IAAI,EAAC,IAAI,EAAC,MAAM,EAAC,WAAW,EAAC,MAAM,EAAA,CAAG,EAChEA,GAAA,CAAA,MAAA,EAAA,EAAM,CAAC,EAAC,oBAAoB,EAAC,MAAM,EAAC,SAAS,EAAC,WAAW,EAAC,GAAG,EAAC,aAAa,EAAC,OAAO,EAAC,cAAc,EAAC,OAAO,GAAG,CAAA,EAAA,CACzG,EAAA,CACC,IACL,CAAA,EAAA,CACL,CACJ,EAAA,CACG;AAEV;;;;"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,379 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
4
|
+
var react = require('react');
|
|
5
|
+
|
|
6
|
+
const DocScan = ({ rectWidth = 640, rectHeight = 400, onCapture, className, style, noShadow = false, }) => {
|
|
7
|
+
const [isConfirming, setIsConfirming] = react.useState(false);
|
|
8
|
+
const [capturedUrl, setCapturedUrl] = react.useState(null);
|
|
9
|
+
const [capturedFile, setCapturedFile] = react.useState(null);
|
|
10
|
+
const videoRef = react.useRef(null);
|
|
11
|
+
const streamRef = react.useRef(null);
|
|
12
|
+
const QUALITY_MULTIPLIER = 3;
|
|
13
|
+
// Crop area (dashed area) as percentages
|
|
14
|
+
const cropTop = 0.1, cropLeft = 0.1, cropWidth = 0.8, cropHeight = 0.8;
|
|
15
|
+
react.useEffect(() => {
|
|
16
|
+
let isMounted = true;
|
|
17
|
+
if (!isConfirming) {
|
|
18
|
+
(async () => {
|
|
19
|
+
try {
|
|
20
|
+
const stream = await navigator.mediaDevices.getUserMedia({ video: { width: rectWidth, height: rectHeight } });
|
|
21
|
+
if (videoRef.current && isMounted) {
|
|
22
|
+
videoRef.current.srcObject = stream;
|
|
23
|
+
videoRef.current.onloadedmetadata = () => {
|
|
24
|
+
videoRef.current?.play();
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
streamRef.current = stream;
|
|
28
|
+
}
|
|
29
|
+
catch (err) {
|
|
30
|
+
console.error(err);
|
|
31
|
+
}
|
|
32
|
+
})();
|
|
33
|
+
}
|
|
34
|
+
return () => {
|
|
35
|
+
isMounted = false;
|
|
36
|
+
if (streamRef.current) {
|
|
37
|
+
streamRef.current.getTracks().forEach((track) => track.stop());
|
|
38
|
+
streamRef.current = null;
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
}, [isConfirming, rectWidth, rectHeight]);
|
|
42
|
+
const handleCapture = () => {
|
|
43
|
+
const video = videoRef.current;
|
|
44
|
+
if (!video)
|
|
45
|
+
return;
|
|
46
|
+
const canvas = document.createElement("canvas");
|
|
47
|
+
canvas.width = rectWidth * QUALITY_MULTIPLIER;
|
|
48
|
+
canvas.height = rectHeight * QUALITY_MULTIPLIER;
|
|
49
|
+
const ctx = canvas.getContext("2d");
|
|
50
|
+
if (ctx) {
|
|
51
|
+
// Aspect-ratio crop to fill the output area
|
|
52
|
+
const videoAspect = video.videoWidth / video.videoHeight;
|
|
53
|
+
const targetAspect = rectWidth / rectHeight;
|
|
54
|
+
let sx = 0, sy = 0, sw = video.videoWidth, sh = video.videoHeight;
|
|
55
|
+
if (videoAspect > targetAspect) {
|
|
56
|
+
// Video is wider than target: crop sides
|
|
57
|
+
sw = video.videoHeight * targetAspect;
|
|
58
|
+
sx = (video.videoWidth - sw) / 2;
|
|
59
|
+
}
|
|
60
|
+
else {
|
|
61
|
+
// Video is taller than target: crop top/bottom
|
|
62
|
+
sh = video.videoWidth / targetAspect;
|
|
63
|
+
sy = (video.videoHeight - sh) / 2;
|
|
64
|
+
}
|
|
65
|
+
ctx.drawImage(video, sx, sy, sw, sh, 0, 0, canvas.width, canvas.height);
|
|
66
|
+
canvas.toBlob((blob) => {
|
|
67
|
+
if (blob) {
|
|
68
|
+
const file = new File([blob], "document.jpg", { type: "image/jpeg" });
|
|
69
|
+
setCapturedFile(file);
|
|
70
|
+
setCapturedUrl(URL.createObjectURL(blob));
|
|
71
|
+
setIsConfirming(true);
|
|
72
|
+
}
|
|
73
|
+
}, "image/jpeg", 0.98);
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
const handleConfirm = () => {
|
|
77
|
+
if (capturedFile) {
|
|
78
|
+
onCapture(capturedFile);
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
const handleDecline = () => {
|
|
82
|
+
if (capturedUrl) {
|
|
83
|
+
URL.revokeObjectURL(capturedUrl);
|
|
84
|
+
}
|
|
85
|
+
setCapturedUrl(null);
|
|
86
|
+
setCapturedFile(null);
|
|
87
|
+
setIsConfirming(false);
|
|
88
|
+
};
|
|
89
|
+
const wrapperStyle = {
|
|
90
|
+
background: '#fff',
|
|
91
|
+
borderRadius: noShadow ? 0 : 10,
|
|
92
|
+
boxShadow: noShadow ? undefined : '0 4px 24px rgba(0,0,0,0.12)',
|
|
93
|
+
padding: 20,
|
|
94
|
+
display: 'flex',
|
|
95
|
+
flexDirection: 'column',
|
|
96
|
+
alignItems: 'center',
|
|
97
|
+
justifyContent: 'center',
|
|
98
|
+
width: rectWidth,
|
|
99
|
+
height: rectHeight + 64,
|
|
100
|
+
margin: '0 auto',
|
|
101
|
+
...style,
|
|
102
|
+
};
|
|
103
|
+
const defaultCameraArea = {
|
|
104
|
+
position: 'relative',
|
|
105
|
+
width: rectWidth - 40,
|
|
106
|
+
height: rectHeight - 40,
|
|
107
|
+
marginBottom: 20,
|
|
108
|
+
display: 'flex',
|
|
109
|
+
alignItems: 'center',
|
|
110
|
+
justifyContent: 'center',
|
|
111
|
+
};
|
|
112
|
+
const defaultDashedArea = {
|
|
113
|
+
position: 'absolute',
|
|
114
|
+
top: `${cropTop * 100}%`,
|
|
115
|
+
left: `${cropLeft * 100}%`,
|
|
116
|
+
width: `${cropWidth * 100}%`,
|
|
117
|
+
height: `${cropHeight * 100}%`,
|
|
118
|
+
border: '2.5px dashed #fff',
|
|
119
|
+
borderRadius: 16,
|
|
120
|
+
boxSizing: 'border-box',
|
|
121
|
+
zIndex: 2,
|
|
122
|
+
background: 'transparent',
|
|
123
|
+
display: 'flex',
|
|
124
|
+
flexDirection: 'column',
|
|
125
|
+
alignItems: 'center',
|
|
126
|
+
};
|
|
127
|
+
const defaultGuidanceText = {
|
|
128
|
+
color: '#fff',
|
|
129
|
+
fontSize: 12,
|
|
130
|
+
fontWeight: 400,
|
|
131
|
+
marginTop: 4,
|
|
132
|
+
marginBottom: 0,
|
|
133
|
+
letterSpacing: 0.2,
|
|
134
|
+
textShadow: '0 1px 4px rgba(0,0,0,0.25)',
|
|
135
|
+
userSelect: 'none',
|
|
136
|
+
};
|
|
137
|
+
const defaultCaptureButton = {
|
|
138
|
+
padding: '12px 32px',
|
|
139
|
+
fontSize: 18,
|
|
140
|
+
borderRadius: 8,
|
|
141
|
+
border: 'none',
|
|
142
|
+
background: '#1976d2',
|
|
143
|
+
color: '#fff',
|
|
144
|
+
cursor: 'pointer',
|
|
145
|
+
boxShadow: '0 2px 8px rgba(0,0,0,0.1)',
|
|
146
|
+
transition: 'background 0.2s',
|
|
147
|
+
margin: '0 auto',
|
|
148
|
+
display: 'block',
|
|
149
|
+
};
|
|
150
|
+
const defaultPreview = {
|
|
151
|
+
width: (rectWidth) * cropWidth,
|
|
152
|
+
height: (rectHeight) * cropHeight,
|
|
153
|
+
display: 'flex',
|
|
154
|
+
alignItems: 'center',
|
|
155
|
+
justifyContent: 'center',
|
|
156
|
+
background: '#111',
|
|
157
|
+
borderRadius: 8,
|
|
158
|
+
margin: '0 auto',
|
|
159
|
+
};
|
|
160
|
+
const defaultConfirmText = {
|
|
161
|
+
textAlign: 'center',
|
|
162
|
+
marginTop: 16,
|
|
163
|
+
color: '#111',
|
|
164
|
+
fontSize: 17,
|
|
165
|
+
fontWeight: 500,
|
|
166
|
+
textShadow: '0 1px 4px rgba(255,255,255,0.12)',
|
|
167
|
+
};
|
|
168
|
+
const defaultIconButton = {
|
|
169
|
+
background: 'none',
|
|
170
|
+
border: 'none',
|
|
171
|
+
cursor: 'pointer',
|
|
172
|
+
padding: 8,
|
|
173
|
+
borderRadius: '50%',
|
|
174
|
+
transition: 'background 0.2s',
|
|
175
|
+
margin: '0 8px',
|
|
176
|
+
};
|
|
177
|
+
return (jsxRuntime.jsx("div", { className: className, style: wrapperStyle, children: !isConfirming ? (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsxs("div", { className: "docscan-camera-area", style: defaultCameraArea, children: [jsxRuntime.jsx("video", { ref: videoRef, width: rectWidth - 40, height: rectHeight - 40, className: "docscan-video", style: {
|
|
178
|
+
width: rectWidth - 40,
|
|
179
|
+
height: rectHeight - 40,
|
|
180
|
+
objectFit: 'cover',
|
|
181
|
+
borderRadius: noShadow ? 0 : 8,
|
|
182
|
+
zIndex: 0,
|
|
183
|
+
}, playsInline: true, muted: true, autoPlay: true }), jsxRuntime.jsx("div", { className: "docscan-dark-overlay", style: {
|
|
184
|
+
position: 'absolute',
|
|
185
|
+
top: 0,
|
|
186
|
+
left: 0,
|
|
187
|
+
width: '100%',
|
|
188
|
+
height: '100%',
|
|
189
|
+
background: 'rgba(0,0,0,0.4)',
|
|
190
|
+
zIndex: 1,
|
|
191
|
+
borderRadius: noShadow ? 0 : 8,
|
|
192
|
+
} }), jsxRuntime.jsx("div", { className: "docscan-dashed-area", style: defaultDashedArea, children: jsxRuntime.jsx("span", { className: "docscan-guidance-text", style: defaultGuidanceText, children: "Place your document here" }) })] }), jsxRuntime.jsx("button", { type: "button", className: "docscan-capture-btn", style: defaultCaptureButton, onClick: handleCapture, children: "Capture" })] })) : (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("div", { className: "docscan-preview", style: defaultPreview, children: capturedUrl && (jsxRuntime.jsx("img", { src: capturedUrl, alt: "Captured document", className: "docscan-preview-img", style: { maxWidth: '100%', maxHeight: '100%', borderRadius: 8 } })) }), jsxRuntime.jsx("div", { className: "docscan-confirm-text", style: defaultConfirmText, children: "Do you want to use this photo?" }), jsxRuntime.jsxs("div", { className: "docscan-confirm-btns", style: { display: 'flex', justifyContent: 'center', gap: 32, marginTop: 16, width: '100%' }, children: [jsxRuntime.jsx("button", { type: "button", "aria-label": "Retake", className: "docscan-icon-btn", style: defaultIconButton, onClick: handleDecline, onMouseOver: e => (e.currentTarget.style.background = 'rgba(211,47,47,0.12)'), onMouseOut: e => (e.currentTarget.style.background = 'none'), children: jsxRuntime.jsxs("svg", { width: "36", height: "36", viewBox: "0 0 36 36", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [jsxRuntime.jsx("circle", { cx: "18", cy: "18", r: "18", fill: "#fff", fillOpacity: "0.15" }), jsxRuntime.jsx("path", { d: "M12 12L24 24", stroke: "#d32f2f", strokeWidth: "3", strokeLinecap: "round" }), jsxRuntime.jsx("path", { d: "M24 12L12 24", stroke: "#d32f2f", strokeWidth: "3", strokeLinecap: "round" })] }) }), jsxRuntime.jsx("button", { type: "button", "aria-label": "Confirm", className: "docscan-icon-btn", style: defaultIconButton, onClick: handleConfirm, onMouseOver: e => (e.currentTarget.style.background = 'rgba(56,142,60,0.12)'), onMouseOut: e => (e.currentTarget.style.background = 'none'), children: jsxRuntime.jsxs("svg", { width: "36", height: "36", viewBox: "0 0 36 36", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [jsxRuntime.jsx("circle", { cx: "18", cy: "18", r: "18", fill: "#fff", fillOpacity: "0.15" }), jsxRuntime.jsx("path", { d: "M10 19L16 25L26 13", stroke: "#388e3c", strokeWidth: "3", strokeLinecap: "round", strokeLinejoin: "round" })] }) })] })] })) }));
|
|
193
|
+
};
|
|
194
|
+
|
|
195
|
+
const FaceCapture = ({ rectWidth = 360, rectHeight = 576, onCapture, className, style, noShadow = false, }) => {
|
|
196
|
+
const [isConfirming, setIsConfirming] = react.useState(false);
|
|
197
|
+
const [capturedUrl, setCapturedUrl] = react.useState(null);
|
|
198
|
+
const [capturedFile, setCapturedFile] = react.useState(null);
|
|
199
|
+
const videoRef = react.useRef(null);
|
|
200
|
+
const streamRef = react.useRef(null);
|
|
201
|
+
const QUALITY_MULTIPLIER = 3;
|
|
202
|
+
react.useEffect(() => {
|
|
203
|
+
let isMounted = true;
|
|
204
|
+
if (!isConfirming) {
|
|
205
|
+
(async () => {
|
|
206
|
+
try {
|
|
207
|
+
const stream = await navigator.mediaDevices.getUserMedia({ video: { width: rectWidth, height: rectHeight } });
|
|
208
|
+
if (videoRef.current && isMounted) {
|
|
209
|
+
videoRef.current.srcObject = stream;
|
|
210
|
+
videoRef.current.onloadedmetadata = () => {
|
|
211
|
+
videoRef.current?.play();
|
|
212
|
+
};
|
|
213
|
+
}
|
|
214
|
+
streamRef.current = stream;
|
|
215
|
+
}
|
|
216
|
+
catch (err) {
|
|
217
|
+
console.error(err);
|
|
218
|
+
}
|
|
219
|
+
})();
|
|
220
|
+
}
|
|
221
|
+
return () => {
|
|
222
|
+
isMounted = false;
|
|
223
|
+
if (streamRef.current) {
|
|
224
|
+
streamRef.current.getTracks().forEach((track) => track.stop());
|
|
225
|
+
streamRef.current = null;
|
|
226
|
+
}
|
|
227
|
+
};
|
|
228
|
+
}, [isConfirming, rectWidth, rectHeight]);
|
|
229
|
+
const handleCapture = () => {
|
|
230
|
+
const video = videoRef.current;
|
|
231
|
+
if (!video)
|
|
232
|
+
return;
|
|
233
|
+
const canvas = document.createElement("canvas");
|
|
234
|
+
canvas.width = rectWidth * QUALITY_MULTIPLIER;
|
|
235
|
+
canvas.height = rectHeight * QUALITY_MULTIPLIER;
|
|
236
|
+
const ctx = canvas.getContext("2d");
|
|
237
|
+
if (ctx) {
|
|
238
|
+
ctx.drawImage(video, 0, 0, rectWidth, rectHeight, 0, 0, rectWidth * QUALITY_MULTIPLIER, rectHeight * QUALITY_MULTIPLIER);
|
|
239
|
+
canvas.toBlob((blob) => {
|
|
240
|
+
if (blob) {
|
|
241
|
+
const file = new File([blob], "face.jpg", { type: "image/jpeg" });
|
|
242
|
+
setCapturedFile(file);
|
|
243
|
+
setCapturedUrl(URL.createObjectURL(blob));
|
|
244
|
+
setIsConfirming(true);
|
|
245
|
+
}
|
|
246
|
+
}, "image/jpeg", 0.98);
|
|
247
|
+
}
|
|
248
|
+
};
|
|
249
|
+
const handleConfirm = () => {
|
|
250
|
+
if (capturedFile) {
|
|
251
|
+
onCapture(capturedFile);
|
|
252
|
+
}
|
|
253
|
+
};
|
|
254
|
+
const handleDecline = () => {
|
|
255
|
+
if (capturedUrl) {
|
|
256
|
+
URL.revokeObjectURL(capturedUrl);
|
|
257
|
+
}
|
|
258
|
+
setCapturedUrl(null);
|
|
259
|
+
setCapturedFile(null);
|
|
260
|
+
setIsConfirming(false);
|
|
261
|
+
};
|
|
262
|
+
const wrapperStyle = {
|
|
263
|
+
background: '#fff',
|
|
264
|
+
borderRadius: noShadow ? 0 : 10,
|
|
265
|
+
boxShadow: noShadow ? undefined : '0 4px 24px rgba(0,0,0,0.12)',
|
|
266
|
+
padding: 20,
|
|
267
|
+
display: 'flex',
|
|
268
|
+
flexDirection: 'column',
|
|
269
|
+
alignItems: 'center',
|
|
270
|
+
justifyContent: 'center',
|
|
271
|
+
width: rectWidth,
|
|
272
|
+
height: rectHeight + 64,
|
|
273
|
+
margin: '0 auto',
|
|
274
|
+
...style,
|
|
275
|
+
};
|
|
276
|
+
const cameraArea = {
|
|
277
|
+
position: 'relative',
|
|
278
|
+
width: rectWidth - 40,
|
|
279
|
+
height: rectHeight - 40,
|
|
280
|
+
marginBottom: 20,
|
|
281
|
+
display: 'flex',
|
|
282
|
+
alignItems: 'center',
|
|
283
|
+
justifyContent: 'center',
|
|
284
|
+
};
|
|
285
|
+
const ovalArea = {
|
|
286
|
+
position: 'absolute',
|
|
287
|
+
top: '18%',
|
|
288
|
+
left: '50%',
|
|
289
|
+
transform: 'translateX(-50%)',
|
|
290
|
+
width: '72%',
|
|
291
|
+
height: '68%',
|
|
292
|
+
zIndex: 2,
|
|
293
|
+
display: 'flex',
|
|
294
|
+
flexDirection: 'column',
|
|
295
|
+
alignItems: 'center',
|
|
296
|
+
justifyContent: 'flex-start',
|
|
297
|
+
pointerEvents: 'none',
|
|
298
|
+
};
|
|
299
|
+
const ovalDashed = {
|
|
300
|
+
width: '100%',
|
|
301
|
+
height: '100%',
|
|
302
|
+
border: '2.5px dashed #fff',
|
|
303
|
+
borderRadius: '50%',
|
|
304
|
+
boxSizing: 'border-box',
|
|
305
|
+
background: 'transparent',
|
|
306
|
+
pointerEvents: 'none',
|
|
307
|
+
};
|
|
308
|
+
const guidanceText = {
|
|
309
|
+
color: '#fff',
|
|
310
|
+
fontSize: 12,
|
|
311
|
+
fontWeight: 400,
|
|
312
|
+
marginTop: 0,
|
|
313
|
+
marginBottom: 4,
|
|
314
|
+
letterSpacing: 0.2,
|
|
315
|
+
textShadow: '0 1px 4px rgba(0,0,0,0.25)',
|
|
316
|
+
userSelect: 'none',
|
|
317
|
+
alignSelf: 'center',
|
|
318
|
+
};
|
|
319
|
+
const captureButton = {
|
|
320
|
+
padding: '12px 32px',
|
|
321
|
+
fontSize: 18,
|
|
322
|
+
borderRadius: 8,
|
|
323
|
+
border: 'none',
|
|
324
|
+
background: '#1976d2',
|
|
325
|
+
color: '#fff',
|
|
326
|
+
cursor: 'pointer',
|
|
327
|
+
boxShadow: '0 2px 8px rgba(0,0,0,0.1)',
|
|
328
|
+
transition: 'background 0.2s',
|
|
329
|
+
margin: '0 auto',
|
|
330
|
+
display: 'block',
|
|
331
|
+
};
|
|
332
|
+
const preview = {
|
|
333
|
+
width: rectWidth - 25,
|
|
334
|
+
height: rectHeight - 25,
|
|
335
|
+
display: 'flex',
|
|
336
|
+
alignItems: 'center',
|
|
337
|
+
justifyContent: 'center',
|
|
338
|
+
background: '#111',
|
|
339
|
+
borderRadius: 8,
|
|
340
|
+
margin: '0 auto',
|
|
341
|
+
};
|
|
342
|
+
const confirmText = {
|
|
343
|
+
textAlign: 'center',
|
|
344
|
+
marginTop: 16,
|
|
345
|
+
color: '#111',
|
|
346
|
+
fontSize: 17,
|
|
347
|
+
fontWeight: 500,
|
|
348
|
+
textShadow: '0 1px 4px rgba(255,255,255,0.12)',
|
|
349
|
+
};
|
|
350
|
+
const iconButton = {
|
|
351
|
+
background: 'none',
|
|
352
|
+
border: 'none',
|
|
353
|
+
cursor: 'pointer',
|
|
354
|
+
padding: 8,
|
|
355
|
+
borderRadius: '50%',
|
|
356
|
+
transition: 'background 0.2s',
|
|
357
|
+
margin: '0 8px',
|
|
358
|
+
};
|
|
359
|
+
return (jsxRuntime.jsx("div", { className: className, style: wrapperStyle, children: !isConfirming ? (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsxs("div", { className: "facecapture-camera-area", style: cameraArea, children: [jsxRuntime.jsx("video", { ref: videoRef, width: rectWidth - 40, height: rectHeight - 40, className: "facecapture-video", style: {
|
|
360
|
+
width: rectWidth - 40,
|
|
361
|
+
height: rectHeight - 40,
|
|
362
|
+
objectFit: 'cover',
|
|
363
|
+
borderRadius: noShadow ? 0 : 8,
|
|
364
|
+
zIndex: 0,
|
|
365
|
+
}, playsInline: true, muted: true, autoPlay: true }), jsxRuntime.jsx("div", { className: "facecapture-dark-overlay", style: {
|
|
366
|
+
position: 'absolute',
|
|
367
|
+
top: 0,
|
|
368
|
+
left: 0,
|
|
369
|
+
width: '100%',
|
|
370
|
+
height: '100%',
|
|
371
|
+
background: 'rgba(0,0,0,0.4)',
|
|
372
|
+
zIndex: 1,
|
|
373
|
+
borderRadius: noShadow ? 0 : 8,
|
|
374
|
+
} }), jsxRuntime.jsxs("div", { className: "facecapture-oval-area", style: ovalArea, children: [jsxRuntime.jsx("span", { className: "facecapture-guidance-text", style: guidanceText, children: "Place your face in the oval" }), jsxRuntime.jsx("div", { className: "facecapture-oval-dashed", style: ovalDashed })] })] }), jsxRuntime.jsx("button", { type: "button", className: "facecapture-capture-btn", style: captureButton, onClick: handleCapture, children: "Capture" })] })) : (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("div", { className: "facecapture-preview", style: preview, children: capturedUrl && (jsxRuntime.jsx("img", { src: capturedUrl, alt: "Captured face", className: "facecapture-preview-img", style: { maxWidth: '100%', maxHeight: '100%', borderRadius: 8 } })) }), jsxRuntime.jsx("div", { className: "facecapture-confirm-text", style: confirmText, children: "Do you want to use this photo?" }), jsxRuntime.jsxs("div", { className: "facecapture-confirm-btns", style: { display: 'flex', justifyContent: 'center', gap: 32, marginTop: 16, width: '100%' }, children: [jsxRuntime.jsx("button", { type: "button", "aria-label": "Retake", className: "facecapture-icon-btn", style: iconButton, onClick: handleDecline, onMouseOver: e => (e.currentTarget.style.background = 'rgba(211,47,47,0.12)'), onMouseOut: e => (e.currentTarget.style.background = 'none'), children: jsxRuntime.jsxs("svg", { width: "36", height: "36", viewBox: "0 0 36 36", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [jsxRuntime.jsx("circle", { cx: "18", cy: "18", r: "18", fill: "#fff", fillOpacity: "0.15" }), jsxRuntime.jsx("path", { d: "M12 12L24 24", stroke: "#d32f2f", strokeWidth: "3", strokeLinecap: "round" }), jsxRuntime.jsx("path", { d: "M24 12L12 24", stroke: "#d32f2f", strokeWidth: "3", strokeLinecap: "round" })] }) }), jsxRuntime.jsx("button", { type: "button", "aria-label": "Confirm", className: "facecapture-icon-btn", style: iconButton, onClick: handleConfirm, onMouseOver: e => (e.currentTarget.style.background = 'rgba(56,142,60,0.12)'), onMouseOut: e => (e.currentTarget.style.background = 'none'), children: jsxRuntime.jsxs("svg", { width: "36", height: "36", viewBox: "0 0 36 36", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [jsxRuntime.jsx("circle", { cx: "18", cy: "18", r: "18", fill: "#fff", fillOpacity: "0.15" }), jsxRuntime.jsx("path", { d: "M10 19L16 25L26 13", stroke: "#388e3c", strokeWidth: "3", strokeLinecap: "round", strokeLinejoin: "round" })] }) })] })] })) }));
|
|
375
|
+
};
|
|
376
|
+
|
|
377
|
+
exports.DocScan = DocScan;
|
|
378
|
+
exports.FaceCapture = FaceCapture;
|
|
379
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../src/DocScan.tsx","../src/FaceCapture.tsx"],"sourcesContent":["import React, { useState, useRef, useEffect } from \"react\";\n\nexport interface DocScanProps {\n rectWidth?: number;\n rectHeight?: number;\n onCapture: (file: File) => void;\n className?: string;\n style?: React.CSSProperties;\n noShadow?: boolean;\n}\n\nexport const DocScan: React.FC<DocScanProps> = ({\n rectWidth = 640,\n rectHeight = 400,\n onCapture,\n className,\n style,\n noShadow = false,\n}) => {\n const [isConfirming, setIsConfirming] = useState(false);\n const [capturedUrl, setCapturedUrl] = useState<string | null>(null);\n const [capturedFile, setCapturedFile] = useState<File | null>(null);\n const videoRef = useRef<HTMLVideoElement>(null);\n const streamRef = useRef<MediaStream | null>(null);\n\n const QUALITY_MULTIPLIER = 3;\n\n // Crop area (dashed area) as percentages\n const cropTop = 0.1, cropLeft = 0.1, cropWidth = 0.8, cropHeight = 0.8;\n\n useEffect(() => {\n let isMounted = true;\n if (!isConfirming) {\n (async () => {\n try {\n const stream = await navigator.mediaDevices.getUserMedia({ video: { width: rectWidth, height: rectHeight } });\n if (videoRef.current && isMounted) {\n videoRef.current.srcObject = stream;\n videoRef.current.onloadedmetadata = () => {\n videoRef.current?.play();\n };\n }\n streamRef.current = stream;\n } catch (err) {\n console.error(err);\n }\n })();\n }\n return () => {\n isMounted = false;\n if (streamRef.current) {\n streamRef.current.getTracks().forEach((track) => track.stop());\n streamRef.current = null;\n }\n };\n }, [isConfirming, rectWidth, rectHeight]);\n\n const handleCapture = () => {\n const video = videoRef.current;\n if (!video) return;\n const canvas = document.createElement(\"canvas\");\n canvas.width = rectWidth * QUALITY_MULTIPLIER;\n canvas.height = rectHeight * QUALITY_MULTIPLIER;\n const ctx = canvas.getContext(\"2d\");\n if (ctx) {\n // Aspect-ratio crop to fill the output area\n const videoAspect = video.videoWidth / video.videoHeight;\n const targetAspect = rectWidth / rectHeight;\n let sx = 0, sy = 0, sw = video.videoWidth, sh = video.videoHeight;\n if (videoAspect > targetAspect) {\n // Video is wider than target: crop sides\n sw = video.videoHeight * targetAspect;\n sx = (video.videoWidth - sw) / 2;\n } else {\n // Video is taller than target: crop top/bottom\n sh = video.videoWidth / targetAspect;\n sy = (video.videoHeight - sh) / 2;\n }\n ctx.drawImage(\n video,\n sx, sy, sw, sh,\n 0, 0,\n canvas.width, canvas.height\n );\n canvas.toBlob((blob) => {\n if (blob) {\n const file = new File([blob], \"document.jpg\", { type: \"image/jpeg\" });\n setCapturedFile(file);\n setCapturedUrl(URL.createObjectURL(blob));\n setIsConfirming(true);\n }\n }, \"image/jpeg\", 0.98);\n }\n };\n\n const handleConfirm = () => {\n if (capturedFile) {\n onCapture(capturedFile);\n }\n };\n\n const handleDecline = () => {\n if (capturedUrl) {\n URL.revokeObjectURL(capturedUrl);\n }\n setCapturedUrl(null);\n setCapturedFile(null);\n setIsConfirming(false);\n };\n\n const wrapperStyle: React.CSSProperties = {\n background: '#fff',\n borderRadius: noShadow ? 0 : 10,\n boxShadow: noShadow ? undefined : '0 4px 24px rgba(0,0,0,0.12)',\n padding: 20,\n display: 'flex',\n flexDirection: 'column',\n alignItems: 'center',\n justifyContent: 'center',\n width: rectWidth,\n height: rectHeight + 64,\n margin: '0 auto',\n ...style,\n };\n\n const defaultCameraArea = {\n position: 'relative',\n width: rectWidth - 40,\n height: rectHeight - 40,\n marginBottom: 20,\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n };\n const defaultDashedArea = {\n position: 'absolute',\n top: `${cropTop * 100}%`,\n left: `${cropLeft * 100}%`,\n width: `${cropWidth * 100}%`,\n height: `${cropHeight * 100}%`,\n border: '2.5px dashed #fff',\n borderRadius: 16,\n boxSizing: 'border-box',\n zIndex: 2,\n background: 'transparent',\n display: 'flex',\n flexDirection: 'column',\n alignItems: 'center',\n };\n const defaultGuidanceText = {\n color: '#fff',\n fontSize: 12,\n fontWeight: 400,\n marginTop: 4,\n marginBottom: 0,\n letterSpacing: 0.2,\n textShadow: '0 1px 4px rgba(0,0,0,0.25)',\n userSelect: 'none',\n };\n const defaultCaptureButton = {\n padding: '12px 32px',\n fontSize: 18,\n borderRadius: 8,\n border: 'none',\n background: '#1976d2',\n color: '#fff',\n cursor: 'pointer',\n boxShadow: '0 2px 8px rgba(0,0,0,0.1)',\n transition: 'background 0.2s',\n margin: '0 auto',\n display: 'block',\n };\n const defaultPreview = {\n width: (rectWidth) * cropWidth,\n height: (rectHeight) * cropHeight,\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n background: '#111',\n borderRadius: 8,\n margin: '0 auto',\n };\n const defaultConfirmText = {\n textAlign: 'center',\n marginTop: 16,\n color: '#111',\n fontSize: 17,\n fontWeight: 500,\n textShadow: '0 1px 4px rgba(255,255,255,0.12)',\n };\n const defaultIconButton = {\n background: 'none',\n border: 'none',\n cursor: 'pointer',\n padding: 8,\n borderRadius: '50%',\n transition: 'background 0.2s',\n margin: '0 8px',\n };\n\n return (\n <div className={className} style={wrapperStyle}>\n {!isConfirming ? (\n <>\n <div className=\"docscan-camera-area\" style={defaultCameraArea as React.CSSProperties}>\n <video\n ref={videoRef}\n width={rectWidth - 40}\n height={rectHeight - 40}\n className=\"docscan-video\"\n style={{\n width: rectWidth - 40,\n height: rectHeight - 40,\n objectFit: 'cover',\n borderRadius: noShadow ? 0 : 8,\n zIndex: 0,\n }}\n playsInline\n muted\n autoPlay\n />\n <div\n className=\"docscan-dark-overlay\"\n style={{\n position: 'absolute' as const,\n top: 0,\n left: 0,\n width: '100%',\n height: '100%',\n background: 'rgba(0,0,0,0.4)',\n zIndex: 1,\n borderRadius: noShadow ? 0 : 8,\n }}\n />\n <div\n className=\"docscan-dashed-area\"\n style={defaultDashedArea as React.CSSProperties}\n >\n <span\n className=\"docscan-guidance-text\"\n style={defaultGuidanceText as React.CSSProperties}\n >\n Place your document here\n </span>\n </div>\n </div> \n <button\n type=\"button\"\n className=\"docscan-capture-btn\"\n style={defaultCaptureButton as React.CSSProperties}\n onClick={handleCapture}\n >\n Capture\n </button>\n </>\n ) : (\n <>\n <div\n className=\"docscan-preview\"\n style={defaultPreview as React.CSSProperties}\n >\n {capturedUrl && (\n <img\n src={capturedUrl}\n alt=\"Captured document\"\n className=\"docscan-preview-img\"\n style={{ maxWidth: '100%', maxHeight: '100%', borderRadius: 8 }}\n />\n )}\n </div>\n <div\n className=\"docscan-confirm-text\"\n style={defaultConfirmText as React.CSSProperties}\n >\n Do you want to use this photo?\n </div>\n <div className=\"docscan-confirm-btns\" style={{ display: 'flex', justifyContent: 'center', gap: 32, marginTop: 16, width: '100%' }}>\n <button\n type=\"button\"\n aria-label=\"Retake\"\n className=\"docscan-icon-btn\"\n style={defaultIconButton as React.CSSProperties}\n onClick={handleDecline}\n onMouseOver={e => (e.currentTarget.style.background = 'rgba(211,47,47,0.12)')}\n onMouseOut={e => (e.currentTarget.style.background = 'none')}\n >\n <svg width=\"36\" height=\"36\" viewBox=\"0 0 36 36\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <circle cx=\"18\" cy=\"18\" r=\"18\" fill=\"#fff\" fillOpacity=\"0.15\" />\n <path d=\"M12 12L24 24\" stroke=\"#d32f2f\" strokeWidth=\"3\" strokeLinecap=\"round\" />\n <path d=\"M24 12L12 24\" stroke=\"#d32f2f\" strokeWidth=\"3\" strokeLinecap=\"round\" />\n </svg>\n </button>\n <button\n type=\"button\"\n aria-label=\"Confirm\"\n className=\"docscan-icon-btn\"\n style={defaultIconButton as React.CSSProperties}\n onClick={handleConfirm}\n onMouseOver={e => (e.currentTarget.style.background = 'rgba(56,142,60,0.12)')}\n onMouseOut={e => (e.currentTarget.style.background = 'none')}\n >\n <svg width=\"36\" height=\"36\" viewBox=\"0 0 36 36\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <circle cx=\"18\" cy=\"18\" r=\"18\" fill=\"#fff\" fillOpacity=\"0.15\" />\n <path d=\"M10 19L16 25L26 13\" stroke=\"#388e3c\" strokeWidth=\"3\" strokeLinecap=\"round\" strokeLinejoin=\"round\" />\n </svg>\n </button>\n </div>\n </>\n )}\n </div>\n );\n}; ","import React, { useState, useRef, useEffect } from \"react\";\n\nexport interface FaceCaptureProps {\n rectWidth?: number;\n rectHeight?: number;\n onCapture: (file: File) => void;\n className?: string;\n style?: React.CSSProperties;\n noShadow?: boolean;\n}\n\nexport const FaceCapture: React.FC<FaceCaptureProps> = ({\n rectWidth = 360,\n rectHeight = 576,\n onCapture,\n className,\n style,\n noShadow = false,\n}) => {\n const [isConfirming, setIsConfirming] = useState(false);\n const [capturedUrl, setCapturedUrl] = useState<string | null>(null);\n const [capturedFile, setCapturedFile] = useState<File | null>(null);\n const videoRef = useRef<HTMLVideoElement>(null);\n const streamRef = useRef<MediaStream | null>(null);\n\n const QUALITY_MULTIPLIER = 3;\n\n useEffect(() => {\n let isMounted = true; \n if (!isConfirming) {\n (async () => {\n try {\n const stream = await navigator.mediaDevices.getUserMedia({ video: { width: rectWidth, height: rectHeight } });\n if (videoRef.current && isMounted) {\n videoRef.current.srcObject = stream;\n videoRef.current.onloadedmetadata = () => {\n videoRef.current?.play();\n };\n }\n streamRef.current = stream;\n } catch (err) {\n console.error(err);\n }\n })();\n }\n return () => {\n isMounted = false;\n if (streamRef.current) {\n streamRef.current.getTracks().forEach((track) => track.stop());\n streamRef.current = null;\n }\n };\n }, [isConfirming, rectWidth, rectHeight]);\n\n const handleCapture = () => {\n const video = videoRef.current;\n if (!video) return;\n const canvas = document.createElement(\"canvas\");\n canvas.width = rectWidth * QUALITY_MULTIPLIER;\n canvas.height = rectHeight * QUALITY_MULTIPLIER;\n const ctx = canvas.getContext(\"2d\");\n if (ctx) {\n ctx.drawImage(\n video,\n 0,\n 0,\n rectWidth,\n rectHeight,\n 0,\n 0,\n rectWidth * QUALITY_MULTIPLIER,\n rectHeight * QUALITY_MULTIPLIER\n );\n canvas.toBlob((blob) => {\n if (blob) {\n const file = new File([blob], \"face.jpg\", { type: \"image/jpeg\" });\n setCapturedFile(file);\n setCapturedUrl(URL.createObjectURL(blob));\n setIsConfirming(true);\n }\n }, \"image/jpeg\", 0.98);\n }\n };\n\n const handleConfirm = () => {\n if (capturedFile) {\n onCapture(capturedFile);\n }\n };\n\n const handleDecline = () => {\n if (capturedUrl) {\n URL.revokeObjectURL(capturedUrl);\n }\n setCapturedUrl(null);\n setCapturedFile(null);\n setIsConfirming(false);\n };\n\n const wrapperStyle: React.CSSProperties = {\n background: '#fff',\n borderRadius: noShadow ? 0 : 10,\n boxShadow: noShadow ? undefined : '0 4px 24px rgba(0,0,0,0.12)',\n padding: 20,\n display: 'flex',\n flexDirection: 'column',\n alignItems: 'center',\n justifyContent: 'center',\n width: rectWidth,\n height: rectHeight + 64,\n margin: '0 auto',\n ...style,\n };\n const cameraArea = {\n position: 'relative' as const,\n width: rectWidth - 40,\n height: rectHeight - 40,\n marginBottom: 20,\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n } as React.CSSProperties;\n const ovalArea = {\n position: 'absolute' as const,\n top: '18%',\n left: '50%',\n transform: 'translateX(-50%)',\n width: '72%',\n height: '68%',\n zIndex: 2,\n display: 'flex',\n flexDirection: 'column' as React.CSSProperties['flexDirection'],\n alignItems: 'center',\n justifyContent: 'flex-start',\n pointerEvents: 'none' as React.CSSProperties['pointerEvents'],\n } as React.CSSProperties;\n const ovalDashed = {\n width: '100%',\n height: '100%',\n border: '2.5px dashed #fff',\n borderRadius: '50%',\n boxSizing: 'border-box' as React.CSSProperties['boxSizing'],\n background: 'transparent',\n pointerEvents: 'none' as React.CSSProperties['pointerEvents'],\n } as React.CSSProperties;\n const guidanceText = {\n color: '#fff',\n fontSize: 12,\n fontWeight: 400,\n marginTop: 0,\n marginBottom: 4,\n letterSpacing: 0.2,\n textShadow: '0 1px 4px rgba(0,0,0,0.25)',\n userSelect: 'none' as React.CSSProperties['userSelect'],\n alignSelf: 'center',\n } as React.CSSProperties;\n const captureButton = {\n padding: '12px 32px',\n fontSize: 18,\n borderRadius: 8,\n border: 'none',\n background: '#1976d2',\n color: '#fff',\n cursor: 'pointer',\n boxShadow: '0 2px 8px rgba(0,0,0,0.1)',\n transition: 'background 0.2s',\n margin: '0 auto',\n display: 'block',\n };\n const preview = {\n width: rectWidth - 25,\n height: rectHeight - 25,\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n background: '#111',\n borderRadius: 8,\n margin: '0 auto',\n };\n const confirmText = {\n textAlign: 'center' as const,\n marginTop: 16,\n color: '#111',\n fontSize: 17,\n fontWeight: 500,\n textShadow: '0 1px 4px rgba(255,255,255,0.12)',\n };\n const iconButton = {\n background: 'none',\n border: 'none',\n cursor: 'pointer',\n padding: 8,\n borderRadius: '50%',\n transition: 'background 0.2s',\n margin: '0 8px',\n };\n\n return (\n <div className={className} style={wrapperStyle}>\n {!isConfirming ? (\n <>\n <div className=\"facecapture-camera-area\" style={cameraArea}>\n <video\n ref={videoRef}\n width={rectWidth - 40}\n height={rectHeight - 40}\n className=\"facecapture-video\"\n style={{\n width: rectWidth - 40,\n height: rectHeight - 40,\n objectFit: 'cover',\n borderRadius: noShadow ? 0 : 8,\n zIndex: 0,\n }}\n playsInline\n muted\n autoPlay\n />\n <div\n className=\"facecapture-dark-overlay\"\n style={{\n position: 'absolute' as const,\n top: 0,\n left: 0,\n width: '100%',\n height: '100%',\n background: 'rgba(0,0,0,0.4)',\n zIndex: 1,\n borderRadius: noShadow ? 0 : 8,\n }}\n />\n <div className=\"facecapture-oval-area\" style={ovalArea}>\n <span className=\"facecapture-guidance-text\" style={guidanceText}>\n Place your face in the oval\n </span>\n <div className=\"facecapture-oval-dashed\" style={ovalDashed}></div>\n </div>\n </div>\n <button\n type=\"button\"\n className=\"facecapture-capture-btn\"\n style={captureButton}\n onClick={handleCapture}\n >\n Capture\n </button>\n </>\n ) : (\n <>\n <div className=\"facecapture-preview\" style={preview}>\n {capturedUrl && (\n <img\n src={capturedUrl}\n alt=\"Captured face\"\n className=\"facecapture-preview-img\"\n style={{ maxWidth: '100%', maxHeight: '100%', borderRadius: 8 }}\n />\n )}\n </div>\n <div className=\"facecapture-confirm-text\" style={confirmText}>\n Do you want to use this photo?\n </div>\n <div className=\"facecapture-confirm-btns\" style={{ display: 'flex', justifyContent: 'center', gap: 32, marginTop: 16, width: '100%' }}>\n <button\n type=\"button\"\n aria-label=\"Retake\"\n className=\"facecapture-icon-btn\"\n style={iconButton}\n onClick={handleDecline}\n onMouseOver={e => (e.currentTarget.style.background = 'rgba(211,47,47,0.12)')}\n onMouseOut={e => (e.currentTarget.style.background = 'none')}\n >\n <svg width=\"36\" height=\"36\" viewBox=\"0 0 36 36\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <circle cx=\"18\" cy=\"18\" r=\"18\" fill=\"#fff\" fillOpacity=\"0.15\" />\n <path d=\"M12 12L24 24\" stroke=\"#d32f2f\" strokeWidth=\"3\" strokeLinecap=\"round\" />\n <path d=\"M24 12L12 24\" stroke=\"#d32f2f\" strokeWidth=\"3\" strokeLinecap=\"round\" />\n </svg>\n </button>\n <button\n type=\"button\"\n aria-label=\"Confirm\"\n className=\"facecapture-icon-btn\"\n style={iconButton}\n onClick={handleConfirm}\n onMouseOver={e => (e.currentTarget.style.background = 'rgba(56,142,60,0.12)')}\n onMouseOut={e => (e.currentTarget.style.background = 'none')}\n >\n <svg width=\"36\" height=\"36\" viewBox=\"0 0 36 36\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <circle cx=\"18\" cy=\"18\" r=\"18\" fill=\"#fff\" fillOpacity=\"0.15\" />\n <path d=\"M10 19L16 25L26 13\" stroke=\"#388e3c\" strokeWidth=\"3\" strokeLinecap=\"round\" strokeLinejoin=\"round\" />\n </svg>\n </button>\n </div>\n </>\n )}\n </div>\n );\n}; "],"names":["useState","useRef","useEffect","_jsx","_jsxs","_Fragment"],"mappings":";;;;;AAWO,MAAM,OAAO,GAA2B,CAAC,EAC9C,SAAS,GAAG,GAAG,EACf,UAAU,GAAG,GAAG,EAChB,SAAS,EACT,SAAS,EACT,KAAK,EACL,QAAQ,GAAG,KAAK,GACjB,KAAI;IACH,MAAM,CAAC,YAAY,EAAE,eAAe,CAAC,GAAGA,cAAQ,CAAC,KAAK,CAAC;IACvD,MAAM,CAAC,WAAW,EAAE,cAAc,CAAC,GAAGA,cAAQ,CAAgB,IAAI,CAAC;IACnE,MAAM,CAAC,YAAY,EAAE,eAAe,CAAC,GAAGA,cAAQ,CAAc,IAAI,CAAC;AACnE,IAAA,MAAM,QAAQ,GAAGC,YAAM,CAAmB,IAAI,CAAC;AAC/C,IAAA,MAAM,SAAS,GAAGA,YAAM,CAAqB,IAAI,CAAC;IAElD,MAAM,kBAAkB,GAAG,CAAC;;AAG5B,IAAA,MAAM,OAAO,GAAG,GAAG,EAAE,QAAQ,GAAG,GAAG,EAAE,SAAS,GAAG,GAAG,EAAE,UAAU,GAAG,GAAG;IAEtEC,eAAS,CAAC,MAAK;QACb,IAAI,SAAS,GAAG,IAAI;QACpB,IAAI,CAAC,YAAY,EAAE;YACjB,CAAC,YAAW;AACV,gBAAA,IAAI;oBACF,MAAM,MAAM,GAAG,MAAM,SAAS,CAAC,YAAY,CAAC,YAAY,CAAC,EAAE,KAAK,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE,EAAE,CAAC;AAC7G,oBAAA,IAAI,QAAQ,CAAC,OAAO,IAAI,SAAS,EAAE;AACjC,wBAAA,QAAQ,CAAC,OAAO,CAAC,SAAS,GA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AAA,EAAA,EAAM,CAAC,EAAC,oBAAoB,EAAC,MAAM,EAAC,SAAS,EAAC,WAAW,EAAC,GAAG,EAAC,aAAa,EAAC,OAAO,EAAC,cAAc,EAAC,OAAO,GAAG,CAAA,EAAA,CACzG,EAAA,CACC,IACL,CAAA,EAAA,CACL,CACJ,EAAA,CACG;AAEV;;;;;"}
|
package/package.json
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "biometry-react-components",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "React UI component library for capturing high-quality biometric data (voice, face, documents, video) to facilitate integration with Biometry services",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"module": "dist/index.esm.js",
|
|
7
|
+
"types": "dist/index.d.ts",
|
|
8
|
+
"files": [
|
|
9
|
+
"dist"
|
|
10
|
+
],
|
|
11
|
+
"scripts": {
|
|
12
|
+
"build": "rollup -c",
|
|
13
|
+
"build:types": "rollup -c rollup.config.dts.js",
|
|
14
|
+
"test": "echo \"Error: no test specified\" && exit 1",
|
|
15
|
+
"prepublishOnly": "npm run build && npm run build:types"
|
|
16
|
+
},
|
|
17
|
+
"keywords": [
|
|
18
|
+
"react",
|
|
19
|
+
"biometrics",
|
|
20
|
+
"face-capture",
|
|
21
|
+
"document-scan",
|
|
22
|
+
"voice-recorder",
|
|
23
|
+
"video-recorder",
|
|
24
|
+
"camera",
|
|
25
|
+
"authentication",
|
|
26
|
+
"identity-verification",
|
|
27
|
+
"liveness-detection"
|
|
28
|
+
],
|
|
29
|
+
"author": "Biometry Team",
|
|
30
|
+
"license": "MIT",
|
|
31
|
+
"repository": {
|
|
32
|
+
"type": "git",
|
|
33
|
+
"url": "https://github.com/your-username/biometry-react-components.git"
|
|
34
|
+
},
|
|
35
|
+
"bugs": {
|
|
36
|
+
"url": "https://github.com/your-username/biometry-react-components/issues"
|
|
37
|
+
},
|
|
38
|
+
"homepage": "https://github.com/your-username/biometry-react-components#readme",
|
|
39
|
+
"devDependencies": {
|
|
40
|
+
"@rollup/plugin-commonjs": "^28.0.6",
|
|
41
|
+
"@rollup/plugin-node-resolve": "^16.0.1",
|
|
42
|
+
"@rollup/plugin-typescript": "^12.1.4",
|
|
43
|
+
"@types/react": "^19.1.8",
|
|
44
|
+
"@types/react-dom": "^19.1.6",
|
|
45
|
+
"react": "^19.1.0",
|
|
46
|
+
"react-dom": "^19.1.0",
|
|
47
|
+
"rollup": "^4.45.1",
|
|
48
|
+
"rollup-plugin-dts": "^6.2.1",
|
|
49
|
+
"rollup-plugin-peer-deps-external": "^2.2.4",
|
|
50
|
+
"typescript": "^5.8.3"
|
|
51
|
+
},
|
|
52
|
+
"peerDependencies": {
|
|
53
|
+
"react": ">=17.0.0",
|
|
54
|
+
"react-dom": ">=17.0.0"
|
|
55
|
+
},
|
|
56
|
+
"dependencies": {
|
|
57
|
+
"react-router-dom": "^7.7.0",
|
|
58
|
+
"tslib": "^2.8.1"
|
|
59
|
+
}
|
|
60
|
+
}
|