UNPKG

@itwin/itwinui-react

Version:

A react component library for iTwinUI

77 lines (76 loc) 2.45 kB
import * as React from 'react'; import type { PolymorphicForwardRefComponent } from '../../utils/index.js'; type FileUploadCardProps = { /** * Files to pass (only needed when passing a custom action) */ files?: File[]; /** * Callback fired when files has changed (only needed passing custom action) */ onFilesChange?: (files: File[]) => void; /** * Node that is shown when there is no file uploaded * Either pass `FileEmptyCard` (for default state) or a different component to show * @default <FileEmptyCard /> */ emptyCard?: React.ReactNode; /** * Input node * @default <FileUploadCard.Input /> */ input?: React.ReactNode; }; /** * Default card to be used with the `FileUpload` wrapper component for single-file uploading. * @example * <FileUploadCard /> * <FileUploadCard files={files} onFilesChange={(files) => setFiles(files)}> * <FileUploadCard.Icon> * <SvgSmileyHappyVery /> * </FileUploadCard.Icon> * <FileUploadCard.Info> * <FileUploadCard.Title>Custom File Name</FileUploadCard.Title> * <FileUploadCard.Description> * Custom File Description * </FileUploadCard.Description> * </FileUploadCard.Info> * <FileUploadCard.Action> * <Button * onClick={() => { * setFiles([]); * }} * /> * <FileUploadCard.Input name={fileInputId} ref={inputRef} /> * </FileUploadCard.Action> * </FileUploadCard> */ export declare const FileUploadCard: PolymorphicForwardRefComponent<"div", FileUploadCardProps> & { Icon: PolymorphicForwardRefComponent<"span", {}>; Info: PolymorphicForwardRefComponent<"span", {}>; Title: PolymorphicForwardRefComponent<"span", {}>; Description: PolymorphicForwardRefComponent<"span", {}>; Action: PolymorphicForwardRefComponent<"div", {}>; InputLabel: PolymorphicForwardRefComponent<"label", {}>; Input: PolymorphicForwardRefComponent<"input", {}>; }; export declare const FileUploadCardContext: React.Context<{ /** * Files to pass */ files: File[]; /** * Callback fired when files have changed */ onFilesChange?: (files: File[]) => void; /** * Sets the state of the files within FileUploadCard */ setInternalFiles: (files: File[]) => void; /** * Id to pass to input */ inputId?: string; setInputId: (inputId: string) => void; } | undefined>; export {};