diff --git a/src/components.d.ts b/src/components.d.ts index eaa2673..72693aa 100644 --- a/src/components.d.ts +++ b/src/components.d.ts @@ -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; @@ -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; diff --git a/src/components/camera/camera.tsx b/src/components/camera/camera.tsx index c200d80..f14f9eb 100644 --- a/src/components/camera/camera.tsx +++ b/src/components/camera/camera.tsx @@ -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; @@ -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" /> )}