UNPKG

apphouse

Version:

Component library for React that uses observable state management and theme-able components.

76 lines (75 loc) 2.06 kB
import { CSSProperties } from 'glamor'; import { BoxSizeStyles, ButtonStyleVariant } from '../../styles/defaults/themes.interface'; import React from 'react'; /** * Interface for the styles to be applied to the ButtonGetFile component */ export interface ButtonGetFileStyle { container?: CSSProperties; button?: CSSProperties; input?: CSSProperties; } /** * Interface for the props of the ButtonGetFile component */ export interface ButtonGetFileProps { /** * @default "primary" */ variant?: keyof ButtonStyleVariant; /** * @default "Choose file" */ label?: React.ReactNode; /** * Overwrites for the styles of the component */ styleOverwrites?: ButtonGetFileStyle; /** * the default onChange event from the input * @param file * @returns */ onChange?: (e: React.ChangeEvent<HTMLInputElement>) => void; /** * Will only be called if parseFileContentOnLoad is false * @param file * @returns */ onFileAvailable?: (file: File) => void; /** * Will only be called if parseFileContentOnLoad is false and multiple is true * @param file * @returns */ onFilesAvailable?: (fileList: FileList) => void; /** * Will only be called if parseFileContentOnLoad is true * otherwise the file will be returned via the onChange * @param file * @returns */ onFileContentAvailable?: (file: File) => void; /** * @default accepts all file types */ acceptedFileTypes?: string[]; onError?: (error: Error) => void; /** * if true it will parse the contents of the file and return it * via onFileContentAvailable * @default false */ parseFileContentOnLoad?: boolean; /** * if true it will allow multiple files to be selected * @default false */ multiple?: boolean; /** * The size of the button * @default "m" */ size?: keyof BoxSizeStyles; } export declare const ButtonGetFile: React.FC<ButtonGetFileProps>;