import { SvelteComponentTyped } from "svelte"; import type { SvelteHTMLElements } from "svelte/elements"; type $RestProps = SvelteHTMLElements["div"]; type $Props = { /** * Specify the accepted file types. * Dropped files that don't match are reported through the `rejected` * event with `reason: 'type'`, like the file picker would exclude them. * @default [] */ accept?: ReadonlyArray; /** * Obtain a reference to the uploaded files. * @default [] */ files?: ReadonlyArray; /** * Set to `true` to allow multiple files * @default false */ multiple?: boolean; /** * Specify the minimum file size in bytes. * Smaller files are filtered out and reported via the `rejected` event * with `reason: 'size'`. Use `1` to reject empty files. */ minFileSize?: number | undefined; /** * Specify the maximum file size in bytes. * Files exceeding this limit are filtered out and reported via the * `rejected` event with `reason: 'size'`. * The limit is a raw byte count: use `5 * 1000 * 1000` for 5 MB * (decimal) or `5 * 1024 * 1024` for 5 MiB (binary). * @example * ```svelte * * * ``` */ maxFileSize?: number | undefined; /** * Set to `true` to reject files that match an already-selected file * (by name, size, and lastModified). Rejected duplicates are reported * via the `rejected` event with `reason: 'duplicate'`. * @default false */ preventDuplicate?: boolean; /** * Override the default behavior of validating uploaded files. * Runs after the `minFileSize`, `maxFileSize`, and `preventDuplicate` checks. * Files removed by this function are reported via `rejected` with * `reason: 'invalid'`. * By default, files are not validated. * @default (files) => files */ validateFiles?: (files: ReadonlyArray) => ReadonlyArray; /** * Specify the label text * @default "Add file" */ labelText?: string; /** * Specify the `role` attribute of the drop container * @default "button" */ role?: string; /** * Open the device camera instead of the file picker on mobile. * `"user"` requests the front camera and `"environment"` the rear camera. * Desktop browsers ignore it and open the file picker. */ capture?: "user" | "environment" | undefined; /** * Set to `true` for the drop area to fill the container instead of * stopping at 20rem. * @default false */ fullWidth?: boolean; /** * Set to `true` to disable the input * @default false */ disabled?: boolean; /** * Specify `tabindex` attribute * @default "0" */ tabindex?: number | string | undefined; /** * Set an id for the input element * @default uniqueId() */ id?: string; /** * Specify a name attribute for the input * @default "" */ name?: string; /** * Specify the id of a form element outside the component to associate * the file input with. */ form?: string | undefined; /** * Obtain a reference to the input HTML element. * @default null */ ref?: null | HTMLInputElement; labelChildren?: (this: void) => void; [key: `data-${string}`]: unknown; }; export type FileUploaderDropContainerProps = Omit<$RestProps, keyof $Props> & $Props; export default class FileUploaderDropContainer extends SvelteComponentTyped< FileUploaderDropContainerProps, { add: CustomEvent>; change: CustomEvent>; click: WindowEventMap["click"]; dragleave: WindowEventMap["dragleave"]; dragover: WindowEventMap["dragover"]; drop: WindowEventMap["drop"]; keydown: WindowEventMap["keydown"]; rejected: CustomEvent>; }, { labelChildren: Record } > {}