import { SvelteComponentTyped } from "svelte"; import type { SvelteHTMLElements } from "svelte/elements"; type $RestProps = SvelteHTMLElements["input"]; type $Props = { /** * Specify the accepted file types. * @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. */ maxFileSize?: number | undefined; /** * Set to `true` to reject files that match an already-selected file * (by name, size, and lastModified). * @default false */ preventDuplicate?: boolean; /** * 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` to select a folder instead of individual files. * Every file inside the folder and its subfolders is added, and each * keeps its `webkitRelativePath`. Browsers do not apply `accept` to * folder contents. * @default false */ directory?: boolean; /** * Set to `true` to disable the input * @default false */ disabled?: boolean; /** * Set to `true` to disable label changes * @default false */ disableLabelChanges?: boolean; /** * Specify the button label after more than one file is picked. * @default (count) => `${count} files` */ fileCountText?: (count: number) => string; /** * Specify the kind of file uploader button. * @default "primary" */ kind?: import("../Button/Button.svelte").ButtonProps["kind"]; /** * Specify the size of the file uploader button. * Inherits the height of the parent `Form` size when unset, * otherwise defaults to `"small"`. * Accepts the same Carbon v11 aliases as `Button`. */ size?: import("../Button/Button.svelte").ButtonProps["size"] | undefined; /** * Specify the label text. * @default "Add file" */ labelText?: string; /** * Set an id for the input element * @default uniqueId() */ id?: string; /** * Specify a name attribute for the input * @default "" */ name?: string; /** * Obtain a reference to the input HTML element. * @default null */ ref?: null | HTMLInputElement; /** * Specify the icon to render. */ icon?: Icon | undefined; /** * Specify the ARIA label for the button icon. */ iconDescription?: string | undefined; /** * Set the tooltip placement in floating-ui form: the side, then `start` * or `end` along it, as Popover's `align` takes. Above and below, * `start` and `end` name inline sides, so they swap under `dir="rtl"`. * When set, takes precedence over `tooltipPosition` and `tooltipAlignment`. */ tooltipAlign?: "top" | "top-start" | "top-end" | "bottom" | "bottom-start" | "bottom-end" | "left" | "left-start" | "left-end" | "right" | "right-start" | "right-end" | undefined; /** * Set the alignment of the tooltip relative to the icon. * Only applies to icon-only buttons. * @deprecated use `tooltipAlign` * @default "center" */ tooltipAlignment?: "start" | "center" | "end"; /** * Set the position of the tooltip relative to the icon. * @deprecated use `tooltipAlign` * @default "bottom" */ tooltipPosition?: "top" | "right" | "bottom" | "left"; /** * Set to `true` to hide the tooltip while maintaining accessibility. * Only applies to icon-only buttons. * When `true`, the tooltip is visually hidden but the `iconDescription` remains accessible to screen readers. * @default false */ hideTooltip?: boolean; labelChildren?: (this: void) => void; [key: `data-${string}`]: unknown; }; export type FileUploaderButtonProps = Omit<$RestProps, keyof $Props> & $Props; export default class FileUploaderButton extends SvelteComponentTyped< FileUploaderButtonProps, { change: CustomEvent>; click: WindowEventMap["click"]; keydown: WindowEventMap["keydown"]; rejected: CustomEvent>; }, { labelChildren: Record } > {}