@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/dist/index.d.cts CHANGED
@@ -42,10 +42,22 @@ type PickerOptions = {
42
42
  /** Maximum file size in bytes. Files above this are rejected at selection. */
43
43
  maxSize?: number;
44
44
  /**
45
- * Upload sources. Currently only 'local_file_system' is supported (MVP).
46
- * Extension point for webcam/URL/cloud pickers.
45
+ * Upload sources offered to the user.
46
+ * 'local_file_system' drag-and-drop + Browse files (always available)
47
+ * 'camera' — capture a photo from the device camera
48
+ *
49
+ * When omitted, all supported sources are offered (camera appears only when
50
+ * the browser supports getUserMedia and the picker accepts images). Pass an
51
+ * explicit list to restrict the sources — e.g. ['local_file_system'] hides
52
+ * the camera even where it is supported.
47
53
  */
48
- fromSources?: Array<'local_file_system'>;
54
+ fromSources?: Array<'local_file_system' | 'camera'>;
55
+ /**
56
+ * Preferred camera when the 'camera' source is used.
57
+ * 'user' — front / selfie camera (mirrored). Default.
58
+ * 'environment' — rear camera.
59
+ */
60
+ cameraFacingMode?: 'user' | 'environment';
49
61
  };
50
62
  /** Props shared by PickerOverlay and DropPane. */
51
63
  type SharedPickerProps = {
@@ -107,6 +119,11 @@ type UsePickerResult = {
107
119
  * Opens when `open={true}`. Calls `onClose` when the user dismisses via ESC,
108
120
  * the backdrop click, or the Cancel button. `onUploadDone` fires after all
109
121
  * selected files have been uploaded.
122
+ *
123
+ * Composes Dropzone, FileQueueRow, and ProgressBar primitives from the #194
124
+ * foundation — no hard-coded brand colors.
125
+ *
126
+ * @dsCard PickerOverlay
110
127
  */
111
128
 
112
129
  type PickerOverlayProps = SharedPickerProps & {
@@ -127,18 +144,83 @@ declare function PickerOverlay({ open, onClose, apikey, apiUrl, security, picker
127
144
  * A non-modal file drop target that renders in-place. Suitable for embedding
128
145
  * directly in a page (e.g. a form upload field) rather than as a modal overlay.
129
146
  *
130
- * Uses usePicker() internally; exposes the same filestack-parity callbacks as
131
- * PickerOverlay. Renders a file list with progress and remove/retry controls
132
- * below the drop zone.
147
+ * Composes the Dropzone, FileQueueRow, and ProgressBar primitives from the
148
+ * #194 foundation. All colors resolve from --uploader-* CSS variables
149
+ * no hard-coded brand colors.
150
+ *
151
+ * States:
152
+ * idle — Dropzone shown, queue empty
153
+ * dragging-over — Dropzone fills with accent-soft, label changes to
154
+ * "Drop to add files" (handled inside Dropzone via isDragOver)
155
+ * queued — Dropzone collapses; file list + Upload/Cancel shown
156
+ * uploading — File rows show per-file progress; aggregate ProgressBar shown
157
+ * done — Files show done state; onUploadDone fires
158
+ *
159
+ * The host supplies any surrounding form chrome (labels, Skip/Continue buttons)
160
+ * as normal JSX siblings — DropPane does not render those.
161
+ *
162
+ * @dsCard DropPane
133
163
  */
134
164
 
135
165
  type DropPaneProps = SharedPickerProps & {
166
+ /**
167
+ * Hint text shown below the Browse button in the dropzone.
168
+ * Default: "or click to browse · max 50 MB"
169
+ */
170
+ hint?: string;
136
171
  /** Additional CSS class(es) applied to the root element. */
137
172
  className?: string;
138
173
  /** Inline styles applied to the root element. */
139
174
  style?: React__default.CSSProperties;
140
175
  };
141
- declare function DropPane({ apikey, apiUrl, security, pickerOptions, onUploadDone, onFileUploadFinished, onFileUploadFailed, onCancel, className, style, }: DropPaneProps): React__default.JSX.Element;
176
+ declare function DropPane({ apikey, apiUrl, security, pickerOptions, onUploadDone, onFileUploadFinished, onFileUploadFailed, onCancel, hint, className, style, }: DropPaneProps): React__default.JSX.Element;
177
+
178
+ /**
179
+ * CameraCapture — in-picker webcam capture.
180
+ *
181
+ * Requests the device camera via getUserMedia, shows a live preview, and lets
182
+ * the user snap a still. The capture is reviewed (Retake / Use photo) before it
183
+ * leaves the component as a regular image `File`, so it flows into the picker
184
+ * queue identically to a dropped or browsed file — preview, edit, and upload.
185
+ *
186
+ * Front ('user') cameras are mirrored in both the preview and the captured
187
+ * still so the selfie matches what the user sees. The MediaStream is stopped on
188
+ * unmount, on capture (to release the camera indicator while reviewing), and on
189
+ * cancel.
190
+ *
191
+ * All colors resolve from --uploader-* CSS variables — no hard-coded brand
192
+ * colors. Used by PickerOverlay and DropPane.
193
+ *
194
+ * @dsCard CameraCapture
195
+ */
196
+
197
+ /** True when the current environment can open a camera stream. */
198
+ declare function isCameraSupported(): boolean;
199
+ /**
200
+ * Decide whether the picker should offer the camera source, given the picker
201
+ * options and the current environment. The camera is offered when:
202
+ * - the browser supports getUserMedia, AND
203
+ * - the accept filter permits images, AND
204
+ * - fromSources is unset or explicitly includes 'camera'.
205
+ */
206
+ declare function shouldOfferCamera(options?: PickerOptions): boolean;
207
+ type CameraCaptureProps = {
208
+ /** Called with the captured still when the user confirms "Use photo". */
209
+ onCapture: (file: File) => void;
210
+ /** Called when the user backs out without capturing. */
211
+ onCancel: () => void;
212
+ /** Which camera to prefer. 'user' = front (mirrored), 'environment' = rear. */
213
+ facingMode?: 'user' | 'environment';
214
+ /** Output MIME type for the still. Default 'image/jpeg'. */
215
+ outputType?: string;
216
+ /** Quality 0–1 for lossy output. Default 0.92. */
217
+ quality?: number;
218
+ /** Base name for the produced file (extension is derived). Default 'camera-photo'. */
219
+ fileNamePrefix?: string;
220
+ className?: string;
221
+ style?: React__default.CSSProperties;
222
+ };
223
+ declare function CameraCapture({ onCapture, onCancel, facingMode, outputType, quality, fileNamePrefix, className, style, }: CameraCaptureProps): React__default.JSX.Element;
142
224
 
143
225
  type UsePickerOptions = UploaderClientOptions & {
144
226
  pickerOptions?: PickerOptions;
@@ -205,4 +287,4 @@ type EditImageOptions = {
205
287
  };
206
288
  declare function editImage(file: File, opts?: EditImageOptions): Promise<File>;
207
289
 
208
- export { type CropArea, DropPane, type DropPaneProps, type EditImageOptions, FileResult, type Flip, ImageEditor, type ImageEditorProps, type PickerFile, type PickerFileState, type PickerOptions, PickerOverlay, type PickerOverlayProps, PickerResponse, type SharedPickerProps, UploaderClientOptions, type UsePickerOptions, type UsePickerResult, editImage, usePicker };
290
+ export { CameraCapture, type CameraCaptureProps, type CropArea, DropPane, type DropPaneProps, type EditImageOptions, FileResult, type Flip, ImageEditor, type ImageEditorProps, type PickerFile, type PickerFileState, type PickerOptions, PickerOverlay, type PickerOverlayProps, PickerResponse, type SharedPickerProps, UploaderClientOptions, type UsePickerOptions, type UsePickerResult, editImage, isCameraSupported, shouldOfferCamera, usePicker };
package/dist/index.d.ts CHANGED
@@ -42,10 +42,22 @@ type PickerOptions = {
42
42
  /** Maximum file size in bytes. Files above this are rejected at selection. */
43
43
  maxSize?: number;
44
44
  /**
45
- * Upload sources. Currently only 'local_file_system' is supported (MVP).
46
- * Extension point for webcam/URL/cloud pickers.
45
+ * Upload sources offered to the user.
46
+ * 'local_file_system' drag-and-drop + Browse files (always available)
47
+ * 'camera' — capture a photo from the device camera
48
+ *
49
+ * When omitted, all supported sources are offered (camera appears only when
50
+ * the browser supports getUserMedia and the picker accepts images). Pass an
51
+ * explicit list to restrict the sources — e.g. ['local_file_system'] hides
52
+ * the camera even where it is supported.
47
53
  */
48
- fromSources?: Array<'local_file_system'>;
54
+ fromSources?: Array<'local_file_system' | 'camera'>;
55
+ /**
56
+ * Preferred camera when the 'camera' source is used.
57
+ * 'user' — front / selfie camera (mirrored). Default.
58
+ * 'environment' — rear camera.
59
+ */
60
+ cameraFacingMode?: 'user' | 'environment';
49
61
  };
50
62
  /** Props shared by PickerOverlay and DropPane. */
51
63
  type SharedPickerProps = {
@@ -107,6 +119,11 @@ type UsePickerResult = {
107
119
  * Opens when `open={true}`. Calls `onClose` when the user dismisses via ESC,
108
120
  * the backdrop click, or the Cancel button. `onUploadDone` fires after all
109
121
  * selected files have been uploaded.
122
+ *
123
+ * Composes Dropzone, FileQueueRow, and ProgressBar primitives from the #194
124
+ * foundation — no hard-coded brand colors.
125
+ *
126
+ * @dsCard PickerOverlay
110
127
  */
111
128
 
112
129
  type PickerOverlayProps = SharedPickerProps & {
@@ -127,18 +144,83 @@ declare function PickerOverlay({ open, onClose, apikey, apiUrl, security, picker
127
144
  * A non-modal file drop target that renders in-place. Suitable for embedding
128
145
  * directly in a page (e.g. a form upload field) rather than as a modal overlay.
129
146
  *
130
- * Uses usePicker() internally; exposes the same filestack-parity callbacks as
131
- * PickerOverlay. Renders a file list with progress and remove/retry controls
132
- * below the drop zone.
147
+ * Composes the Dropzone, FileQueueRow, and ProgressBar primitives from the
148
+ * #194 foundation. All colors resolve from --uploader-* CSS variables
149
+ * no hard-coded brand colors.
150
+ *
151
+ * States:
152
+ * idle — Dropzone shown, queue empty
153
+ * dragging-over — Dropzone fills with accent-soft, label changes to
154
+ * "Drop to add files" (handled inside Dropzone via isDragOver)
155
+ * queued — Dropzone collapses; file list + Upload/Cancel shown
156
+ * uploading — File rows show per-file progress; aggregate ProgressBar shown
157
+ * done — Files show done state; onUploadDone fires
158
+ *
159
+ * The host supplies any surrounding form chrome (labels, Skip/Continue buttons)
160
+ * as normal JSX siblings — DropPane does not render those.
161
+ *
162
+ * @dsCard DropPane
133
163
  */
134
164
 
135
165
  type DropPaneProps = SharedPickerProps & {
166
+ /**
167
+ * Hint text shown below the Browse button in the dropzone.
168
+ * Default: "or click to browse · max 50 MB"
169
+ */
170
+ hint?: string;
136
171
  /** Additional CSS class(es) applied to the root element. */
137
172
  className?: string;
138
173
  /** Inline styles applied to the root element. */
139
174
  style?: React__default.CSSProperties;
140
175
  };
141
- declare function DropPane({ apikey, apiUrl, security, pickerOptions, onUploadDone, onFileUploadFinished, onFileUploadFailed, onCancel, className, style, }: DropPaneProps): React__default.JSX.Element;
176
+ declare function DropPane({ apikey, apiUrl, security, pickerOptions, onUploadDone, onFileUploadFinished, onFileUploadFailed, onCancel, hint, className, style, }: DropPaneProps): React__default.JSX.Element;
177
+
178
+ /**
179
+ * CameraCapture — in-picker webcam capture.
180
+ *
181
+ * Requests the device camera via getUserMedia, shows a live preview, and lets
182
+ * the user snap a still. The capture is reviewed (Retake / Use photo) before it
183
+ * leaves the component as a regular image `File`, so it flows into the picker
184
+ * queue identically to a dropped or browsed file — preview, edit, and upload.
185
+ *
186
+ * Front ('user') cameras are mirrored in both the preview and the captured
187
+ * still so the selfie matches what the user sees. The MediaStream is stopped on
188
+ * unmount, on capture (to release the camera indicator while reviewing), and on
189
+ * cancel.
190
+ *
191
+ * All colors resolve from --uploader-* CSS variables — no hard-coded brand
192
+ * colors. Used by PickerOverlay and DropPane.
193
+ *
194
+ * @dsCard CameraCapture
195
+ */
196
+
197
+ /** True when the current environment can open a camera stream. */
198
+ declare function isCameraSupported(): boolean;
199
+ /**
200
+ * Decide whether the picker should offer the camera source, given the picker
201
+ * options and the current environment. The camera is offered when:
202
+ * - the browser supports getUserMedia, AND
203
+ * - the accept filter permits images, AND
204
+ * - fromSources is unset or explicitly includes 'camera'.
205
+ */
206
+ declare function shouldOfferCamera(options?: PickerOptions): boolean;
207
+ type CameraCaptureProps = {
208
+ /** Called with the captured still when the user confirms "Use photo". */
209
+ onCapture: (file: File) => void;
210
+ /** Called when the user backs out without capturing. */
211
+ onCancel: () => void;
212
+ /** Which camera to prefer. 'user' = front (mirrored), 'environment' = rear. */
213
+ facingMode?: 'user' | 'environment';
214
+ /** Output MIME type for the still. Default 'image/jpeg'. */
215
+ outputType?: string;
216
+ /** Quality 0–1 for lossy output. Default 0.92. */
217
+ quality?: number;
218
+ /** Base name for the produced file (extension is derived). Default 'camera-photo'. */
219
+ fileNamePrefix?: string;
220
+ className?: string;
221
+ style?: React__default.CSSProperties;
222
+ };
223
+ declare function CameraCapture({ onCapture, onCancel, facingMode, outputType, quality, fileNamePrefix, className, style, }: CameraCaptureProps): React__default.JSX.Element;
142
224
 
143
225
  type UsePickerOptions = UploaderClientOptions & {
144
226
  pickerOptions?: PickerOptions;
@@ -205,4 +287,4 @@ type EditImageOptions = {
205
287
  };
206
288
  declare function editImage(file: File, opts?: EditImageOptions): Promise<File>;
207
289
 
208
- export { type CropArea, DropPane, type DropPaneProps, type EditImageOptions, FileResult, type Flip, ImageEditor, type ImageEditorProps, type PickerFile, type PickerFileState, type PickerOptions, PickerOverlay, type PickerOverlayProps, PickerResponse, type SharedPickerProps, UploaderClientOptions, type UsePickerOptions, type UsePickerResult, editImage, usePicker };
290
+ export { CameraCapture, type CameraCaptureProps, type CropArea, DropPane, type DropPaneProps, type EditImageOptions, FileResult, type Flip, ImageEditor, type ImageEditorProps, type PickerFile, type PickerFileState, type PickerOptions, PickerOverlay, type PickerOverlayProps, PickerResponse, type SharedPickerProps, UploaderClientOptions, type UsePickerOptions, type UsePickerResult, editImage, isCameraSupported, shouldOfferCamera, usePicker };