import { FileFieldItemProps } from "./FileFieldItem.mjs"; import { FieldBaseProps } from "../FieldBase/FieldBase.mjs"; import { WidthProp } from "@marigold/system"; import RAC from "react-aria-components"; import { ValidationError } from "@react-types/shared"; type RemovedProps = 'className' | 'style' | 'children' | 'isDisabled' | 'isRequired'; export interface FileFieldProps extends Omit, Pick, 'label' | 'addon' | 'description' | 'errorMessage'> { /** * Visual variant of the component. Which values exist is defined by the theme * and listed in the "Appearance" section of the component's documentation. */ variant?: string; /** * Size of the component. Which values exist is defined by the theme and listed * in the "Appearance" section of the component's documentation. */ size?: 'default' | 'small' | (string & {}); /** * Sets the width of the field. You can see allowed tokens here: https://tailwindcss.com/docs/width * * Numeric/scale values are spacing-scale tokens, not pixels: `width={64}` * resolves to `calc(var(--spacing) * 64)` ~= 16rem (256px), not 64px. * @default full */ width?: WidthProp['width']; /** * Disables the trigger. * @default false */ disabled?: RAC.DropZoneProps['isDisabled']; /** * Accepted file types for selection. */ accept?: RAC.FileTriggerProps['acceptedFileTypes']; /** * Whether multiple files can be selected. */ multiple?: RAC.FileTriggerProps['allowsMultiple']; /** * The name of the field for form submission. */ name?: string; /** * Associates the hidden input with a `
` element by id. */ form?: string; /** * If `true`, the field is considered invalid and the `errorMessage` is shown. * @default false */ error?: boolean; /** * If `true`, the field is required and an empty selection blocks submission. * Only enforced with `validationBehavior="native"`. * @default false */ required?: boolean; /** * The largest size a single file may have, in bytes. Files above it are * rejected with an error instead of being added. */ maxSize?: number; /** * Custom client-side validation. Receives the selected files. Return a * string (or array of strings) to mark the field invalid, or * `true`/`null`/`undefined` for valid. */ validate?: (files: File[]) => ValidationError | true | null | undefined; /** * Whether to use native HTML form validation or ARIA validation. * Inherits from an ancestor `` when omitted. */ validationBehavior?: 'aria' | 'native'; /** * Called before a file is removed. Return `false`, or a promise resolving to * `false`, to keep the file, which is how a confirmation goes in front of the * remove button. If the handler throws, the file is kept and the error * propagates. */ onBeforeRemove?: (file: File) => boolean | Promise; } export declare const FileField: { ({ disabled, accept, multiple, width, label, addon, name, size, variant, description, errorMessage, error, required, form, maxSize, validate, validationBehavior: validationBehaviorProp, onBeforeRemove, "aria-describedby": ariaDescribedBy, ...props }: FileFieldProps): import("react").JSX.Element; Item: ({ children, onRemove, removeLabel, size }: FileFieldItemProps) => import("react").JSX.Element; }; export {};