Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions src/components.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ export namespace Components {
"options": ActionSheetOption[];
}
interface PwaCamera {
/**
* The acceptable image input for selection when a camera is not available. Defaults to: `image/*`.
* @see https://html.spec.whatwg.org/multipage/input.html#attr-input-accept
*/
"accept": string;
"facingMode": string;
"handleNoDeviceError": (e?: any) => void;
"handlePhoto": (photo: Blob) => void;
Expand Down Expand Up @@ -94,6 +99,11 @@ declare namespace LocalJSX {
"options"?: ActionSheetOption[];
}
interface PwaCamera {
/**
* The acceptable image input for selection when a camera is not available. Defaults to: `image/*`.
* @see https://html.spec.whatwg.org/multipage/input.html#attr-input-accept
*/
"accept"?: string;
"facingMode"?: string;
"handleNoDeviceError"?: (e?: any) => void;
"handlePhoto"?: (photo: Blob) => void;
Expand Down
9 changes: 8 additions & 1 deletion src/components/camera/camera.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,13 @@ export class CameraPWA {
@Prop() handleNoDeviceError: (e?: any) => void;
@Prop() noDevicesText = 'No camera found';
@Prop() noDevicesButtonText = 'Choose image';
/**
* The acceptable image input for selection when a camera is not available.
* Defaults to: `image/*`.
*
* @see https://html.spec.whatwg.org/multipage/input.html#attr-input-accept
*/
@Prop() accept = 'image/*';

@State() photo: any;
@State() photoSrc: any;
Expand Down Expand Up @@ -427,7 +434,7 @@ export class CameraPWA {
type="file"
id="_pwa-elements-camera-input"
onChange={this.handleFileInputChange}
accept="image/*"
accept={this.accept}
class="select-file-button" />
</div>
)}
Expand Down