@mitcsutt/kiln-forms
Version:
Kiln forms: typed React forms on TanStack Form, in component or JSON schema mode, rendered through kiln-ui
35 lines (34 loc) • 1.32 kB
TypeScript
import { type FileFieldProps as UiFileFieldProps, type FileRejection, type FileValue } from '@mitcsutt/kiln-ui';
import type { ControlledKeys } from '../internal/controlledKeys.js';
import { type CommonFieldProps } from '../../../hooks/useFieldBinding.js';
export interface FormFileFieldProps extends Omit<UiFileFieldProps, ControlledKeys | 'onReject'>, CommonFieldProps<readonly FileValue[]> {
/**
* Files that weren't added, and why — forwarded after the field's own error is set.
*
* @privateRemarks Design reference §7.3.
*/
onReject?: (rejections: readonly FileRejection[]) => void;
}
/**
* File picking bound to an array of files. Files are held in the form, not uploaded.
*
* @remarks
* It renders kiln-ui's {@link FileField | FileField}.
*
* @example In a schema
* ```json
* {
* "kind": "file",
* "name": "photo",
* "label": "Photo for your pass",
* "accept": "image/jpeg,image/png"
* }
* ```
*
* @value `ReadonlyArray<File | StoredFile>`
* @empty `[]`
*
* @privateRemarks
* File picking bound to a `FileValue[]` path (§7.2 `file`). Empty is `[]`; files aren't uploaded.
*/
export declare const FormFileField: import("../../../kit/contracts.js").FieldDef<import("../../../kit/contracts.js").ExactContract<readonly FileValue[]>, FormFileFieldProps>;