import * as _angular_core from '@angular/core'; import { InjectionToken, Signal } from '@angular/core'; import * as forty_cdk_file_upload from 'forty-cdk/file-upload'; /** * Shared state contract between the pieces of a FileUpload primitive. * Provided by `ForFileUpload`, consumed by `ForFileUploadInput` and * `ForFileUploadTrigger`. */ interface ForFileUploadContext { readonly accept: Signal; readonly multiple: Signal; readonly directory: Signal; readonly disabled: Signal; /** * Registers the native `` so the root can open the dialog * and sync dropped files. Pair with {@link ForFileUploadContext.unregisterInput} * so an unmounted input is dropped instead of leaving the root holding a * detached element. */ registerInput(el: HTMLInputElement): void; /** Removes a previously registered native `` (no-op unless it is registered). */ unregisterInput(el: HTMLInputElement): void; /** Opens the native file chooser dialog by programmatically clicking the registered input. */ openFileDialog(): void; /** * Filters the given `FileList` against `accept` and against the single-file * cap of `multiple="false"`, syncs the registered input's `files` for native * form submission, then emits `filesChange` (accepted) and `filesRejected` * (every refused file plus the constraint that refused it). Shared by the * drag&drop and dialog paths. */ acceptFiles(files: FileList): void; } declare const FOR_FILE_UPLOAD_CONTEXT: InjectionToken; /** * Why `[forFileUpload]` refused a selected file. * * - `'accept'` — the file failed the root's `accept` filter (file-extension or * `type/*` MIME matching), from a drop or from a dialog selection made * through the "All files" override. * - `'multiple'` — the file passed `accept` but arrived past the single-file * cap imposed by `multiple="false"`. * * Treat the union as open: a future constraint adds a member, so a consumer * switching on it should keep a default branch. */ type ForFileUploadRejectionReason = 'accept' | 'multiple'; /** A file `[forFileUpload]` refused, paired with the constraint that refused it. */ interface ForFileUploadRejection { /** The refused file. */ readonly file: File; /** Which constraint refused it. */ readonly reason: ForFileUploadRejectionReason; } /** * Root drop zone for the FileUpload primitive. Composes with * `[forFileUploadInput]` (the accessible native file input) and * `[forFileUploadTrigger]` (the button that opens the dialog). * * `filesChange` is a plain `output()` — this primitive is not a * Signal Forms control; the native `` is the form participant. * * Files chosen through either entry point — the native dialog or a drag&drop — * are filtered against `accept` (file-extension and `type/*` MIME matching) * before `filesChange`. The native `accept` attribute only constrains the * dialog's default filter, so a drop, or a dialog selection made through the * "All files" override, could otherwise leak a rejected file into `filesChange` * and into the input's `files` (native form submission). Files that fail the * filter are emitted on `filesRejected` instead, as are valid files that * arrive past the single-file cap of `multiple="false"` — every selected file * lands in exactly one of the two outputs. * * Reflects `data-dragging` while files are dragged over the zone and * `data-disabled` when the input is disabled. */ declare class ForFileUpload implements ForFileUploadContext { #private; /** MIME types or file extensions accepted by the file chooser (e.g. `"image/*,.pdf"`). */ readonly accept: _angular_core.InputSignal; /** Whether multiple files can be selected at once. */ readonly multiple: _angular_core.InputSignalWithTransform; /** * When `true`, the native picker selects a whole folder; the emitted * `FileList` then contains every file inside it (each carrying a * `webkitRelativePath` so the consumer can reconstruct the tree). */ readonly directory: _angular_core.InputSignalWithTransform; /** Whether the file upload zone and all its pieces are disabled. */ readonly disabled: _angular_core.InputSignalWithTransform; /** Emitted when files are chosen via the dialog or dropped onto the zone. */ readonly filesChange: _angular_core.OutputEmitterRef; /** * Emitted with the files that were not accepted, each paired with the * constraint that refused it: `'accept'` for a file that failed the `accept` * filter (from a drop or a dialog selection made through the "All files" * override), `'multiple'` for a valid file that arrived past the single-file * cap of `multiple="false"`. Fires only when at least one file was refused. */ readonly filesRejected: _angular_core.OutputEmitterRef; protected readonly dragging: _angular_core.Signal; /** * Registers the native input so the root can open the dialog and sync * dropped files. Pair with {@link unregisterInput} through the core * `registerHandle` helper so an unmounted input is dropped. */ registerInput(el: HTMLInputElement): void; /** Removes a previously registered native input (no-op unless it is registered). */ unregisterInput(el: HTMLInputElement): void; /** Opens the native file chooser dialog if not disabled. */ openFileDialog(): void; /** * Filters `files` against `accept` and against the single-file cap of * `multiple="false"`, syncs the registered input's `files` for native form * submission, then emits `filesChange` with the accepted set and * `filesRejected` with every refused file plus the reason it was refused. * Shared by the drag&drop and dialog paths so both constraints are enforced * identically through either entry point and they cannot diverge. Every * selected file lands in exactly one of the two outputs. When nothing is * accepted and `files` is the registered input's own `FileList` (the dialog * path), the input is cleared so a native form submission cannot ship a file * the primitive rejected. */ acceptFiles(files: FileList): void; protected onDragEnter(event: DragEvent): void; protected onDragOver(event: DragEvent): void; protected onDragLeave(): void; protected onDrop(event: DragEvent): void; static ɵfac: _angular_core.ɵɵFactoryDeclaration; static ɵdir: _angular_core.ɵɵDirectiveDeclaration; } /** * The native `` piece of the FileUpload primitive. * Apply on a real `` element inside `[forFileUpload]`. * * The directive forces `type="file"` and mirrors `accept`, `multiple`, * `directory` (as `webkitdirectory`), and `disabled` from the root context. * When the user selects files via the native dialog the `change` event routes * them through the root's shared `accept` filter — so a selection made through * the dialog's "All files" override is rejected consistently with a drop — * emitting `filesChange` (accepted) / `filesRejected` (rejected) on the root. * * Consumers are expected to visually hide this input with their own CSS * (e.g. an `sr-only` / `visually-hidden` utility) while keeping it focusable * so keyboard users and assistive technology can activate it directly. The * directive never sets `hidden`, `display:none`, or `visibility:hidden` — it * remains strictly headless. */ declare class ForFileUploadInput { #private; protected readonly ctx: forty_cdk_file_upload.ForFileUploadContext; constructor(); protected onChange(): void; static ɵfac: _angular_core.ɵɵFactoryDeclaration; static ɵdir: _angular_core.ɵɵDirectiveDeclaration; } /** * Trigger button that opens the native file chooser dialog. * Apply on a native `