@ibanzajoe/uploader 0.1.0 → 0.2.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/README.md +32 -0
- package/dist/index.cjs +709 -289
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +90 -8
- package/dist/index.d.ts +90 -8
- package/dist/index.js +708 -291
- package/dist/index.js.map +1 -1
- package/dist/styles.css +561 -129
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -64,6 +64,38 @@ Inline drop zone that can be embedded in a form.
|
|
|
64
64
|
|
|
65
65
|
Headless hook — returns `{ open, uploading, files, errors }`.
|
|
66
66
|
|
|
67
|
+
## Camera capture
|
|
68
|
+
|
|
69
|
+
Both `<PickerOverlay>` and `<DropPane>` can capture a photo straight from the
|
|
70
|
+
device camera. A **Take photo** button appears next to **Browse files** whenever
|
|
71
|
+
the browser supports `getUserMedia` and the picker accepts images. The capture
|
|
72
|
+
flows through the exact same pipeline as a dropped or browsed file — it lands in
|
|
73
|
+
the queue with a preview, can be cropped/rotated in the in-picker editor, and is
|
|
74
|
+
then uploaded normally.
|
|
75
|
+
|
|
76
|
+
```tsx
|
|
77
|
+
<PickerOverlay
|
|
78
|
+
apikey="pk_…"
|
|
79
|
+
open={open}
|
|
80
|
+
onClose={() => setOpen(false)}
|
|
81
|
+
pickerOptions={{
|
|
82
|
+
accept: ['image/*'],
|
|
83
|
+
// Sources offered to the user. Omit to offer everything supported.
|
|
84
|
+
fromSources: ['local_file_system', 'camera'],
|
|
85
|
+
// 'user' = front/selfie (mirrored, default) · 'environment' = rear camera
|
|
86
|
+
cameraFacingMode: 'environment',
|
|
87
|
+
}}
|
|
88
|
+
/>
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
Notes:
|
|
92
|
+
- The camera requires a **secure context** (HTTPS or `localhost`) and user
|
|
93
|
+
permission. Permission/no-camera errors are surfaced inline with a retry.
|
|
94
|
+
- Pass `fromSources: ['local_file_system']` to hide the camera even where it is
|
|
95
|
+
supported; omit `fromSources` to offer it by default.
|
|
96
|
+
- The `<CameraCapture>` component and the `isCameraSupported()` /
|
|
97
|
+
`shouldOfferCamera()` helpers are exported for fully custom pickers.
|
|
98
|
+
|
|
67
99
|
## Signed policies
|
|
68
100
|
|
|
69
101
|
When the account has `requireSigned` enabled, pass a signed policy on upload:
|