import { ChangeEventHandler, ReactNode, Ref } from 'react'; import { type UploaderHintType, type UploaderMode, type UploadPictureControl, type UploadType } from '@mezzanine-ui/core/upload'; import { type IconDefinition } from '@mezzanine-ui/icons'; import { NativeElementPropsWithoutKeyAndRef } from '../utils/jsx-types'; type UploaderInputElementProps = Omit, 'accept' | 'disabled' | 'multiple' | 'onChange' | 'type' | `aria-${'disabled'}`> & { /** * The id attribute can be provided via inputProps, but it's recommended to use the `id` prop directly. * If both are provided, the `id` prop takes precedence. */ id?: string; /** * The name attribute can be provided via inputProps, but it's recommended to use the `name` prop directly. * If both are provided, the `name` prop takes precedence. */ name?: string; }; export interface UploaderHint { /** * The label text of the hint. */ label: string; /** * The icon element of the hint. */ type?: UploaderHintType; } export interface UploaderLabel { /** * Label text for upload state. */ uploadLabel?: string; /** * Label text for uploading state. */ uploadingLabel?: string; /** * Label text for success state. */ success?: string; /** * Label text for error state. */ error?: string; /** * Label text for "Click to upload" in `mode="dropzone"`. * @default 'Click to upload' */ clickToUpload?: string; } export interface UploaderIcon { /** * Icon for upload action. */ upload?: IconDefinition; /** * Icon for error state. */ error?: ReactNode; /** * Icon for success state. */ success?: ReactNode; /** * Icon for zoom action. */ zoom?: ReactNode; /** * Icon for document. */ document?: ReactNode; /** * Icon for download action. */ download?: ReactNode; /** * Icon for reload action. */ reload?: ReactNode; /** * Icon for delete action. */ delete?: ReactNode; } export interface UploaderProps extends Omit, 'onChange'> { /** * The accept attributes of native input element. * @example 'image/*', '.pdf,.doc,.docx' */ accept?: string; /** * Provide `controllerRef` if you need detail data of file. */ controllerRef?: Ref; /** * Whether the input is disabled. * @default false */ disabled?: boolean; /** * Array of hints to display outside the uploader (below the label element). */ externalHints?: UploaderHint[]; /** * Array of hints to display with the upload component. */ hints?: UploaderHint[]; /** * Icon configuration for different actions and states. */ icon?: UploaderIcon; /** * The id of input element. */ id?: string; /** * Since at Mezzanine we use a host element to wrap our input, most derived props will be passed to the host element. * If you need direct control to the input element, use this prop to provide to it. */ inputProps?: UploaderInputElementProps; /** * The react ref passed to input element. */ inputRef?: React.Ref; /** * Label configuration for different states. */ label?: UploaderLabel; /** * The name attribute of the input element. */ name?: string; /** * The mode for upload component. * @default 'basic' * @example 'basic' | 'dropzone' */ mode?: UploaderMode; /** * Whether can select multiple files to upload. * @default false */ multiple?: boolean; /** * Invoked by input change event. */ onChange?: ChangeEventHandler; /** * Fired after user selected files. */ onUpload?: (files: File[]) => void; /** * The type for upload component. * @default 'base' * @example 'base' | 'button' */ type?: UploadType; } /** * The react component for `mezzanine` uploader. */ declare const Uploader: import("react").ForwardRefExoticComponent>; export default Uploader;