UNPKG

@wix/design-system

Version:

@wix/design-system

40 lines 1.8 kB
import { ValuesOf } from '../utils/typeUtils'; import { CAPTURE } from './FileUpload.constants'; export interface FileUploadProps { /** Applies a data-hook HTML attribute that can be used in tests. */ dataHook?: string; /** Specifies a CSS class name to be appended to the component’s root element. * @internal */ className?: string; /** Accepts any kind of component as a child item that calls out the file picker. * ##### Syntax: * function({ openFileUpload }): element * * `openFileUpload`: A function that will open a file upload dialog when triggered. * * return: A react element */ children: (params: FileUploadChildrenProps) => React.ReactNode; /** Allows you to select and upload multiple files at once. * @default false */ multiple?: boolean; /** Defines which file types to accept (i.e. .jpeg, .gif, .png). Each format should be separated by a comma. */ accept?: string; /** Specifies that a new file should be captured and which camera to use to capture the image or video data. * `Use user` for the user-facing camera and `environment` for the outward-facing camera. * ##### Note: This only works on mobile devices; * If your device is a desktop computer, you'll get a standard file picker. * @default `user` * */ capture?: FileUploadCapture; /** Specifies a form data name to be submitted along with the control value. */ name?: string; /** Defines a standard input onChange callback. */ onChange: (files: FileList | null) => void; } type FileUploadChildrenProps = { openFileUploadDialog: React.MouseEventHandler<HTMLElement>; }; export type FileUploadCapture = ValuesOf<typeof CAPTURE>; export {}; //# sourceMappingURL=FileUpload.types.d.ts.map