import React, { FC, ReactNode, ChangeEvent, MouseEvent } from 'react'; import { BoxProps } from '../Box/Box'; import { ButtonSize, ButtonTone, ButtonVariant } from '../Button/Button'; import { IconName } from '../../types'; export interface FileUploadProps extends BoxProps { /** * Id for the file input element. */ id: string; /** * Label to be used for input. It is required for accessibility reasons although it will not be displayed. */ labelText: string; /** * Name attribute for input element. */ name: string; /** * Callback fired when there is a change event on the file input. * Files can be accessed from this change event as `event.target.files`; */ onChange: (event: ChangeEvent) => void; /** * HTML attribute that specifies what type of files are accepted for upload. * [Read More](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/accept) */ accept?: string; /** * Text to be rendered in file input button. */ buttonText?: ReactNode; /** * Custom classname to apply to component wrapper. */ className?: string; /** * Mark the input field as invalid and display a validation message. * Pass a string or node to render a validation message below the input. */ error?: ReactNode; /** * The max number of characters displayed in file names. * The component will preserve the the first n / 2 characters and the last n / 2 characters, * including the file extension. It will only truncate characters in the middle, following * a native HTML file input. */ fileNameMaxLength?: number; /** * File list array-like */ files?: FileList; /** * Whether to render the button with 100% width. */ fullWidth?: boolean; /** * Controls whether an upload icon is shown in the button. */ hasIcon?: boolean; /** * Additional clarifying text to help describe the type of acceptable files */ helpText?: ReactNode; /** * Name of the icon displayed inside the button */ iconName?: IconName; /** * Props passed directly to the input element of the component */ inputProps?: BoxProps & React.HTMLProps; /** * Whether the file upload is disabled */ isDisabled?: boolean; /** * Determines if input is required or not */ isRequired?: boolean; /** * Input `multiple` attribute, pass `true` if you wish to upload multiple files. */ multiple?: boolean; /** * Input `multiple` attribute, pass `true` if you wish to upload multiple files. */ onClearFiles?: (event: MouseEvent) => void; /** * Visual indicator that the field is required, that gets appended to the label */ requiredIndicator?: ReactNode; /** * Size of component. Matches Button sizes. */ size?: ButtonSize; /** * Indicate the intent of the action the button performs. */ tone?: ButtonTone; /** * Color and visual weight for the button. */ variant?: ButtonVariant; /** * Additional props to be spread. IMPORTANT: these will be spread ONLY to the * `input` element in the component since it is the actual semantic file input * present. */ [x: string]: any; } export declare const FileUpload: FC;