import { SvelteComponentTyped } from "svelte"; import type { SvelteHTMLElements } from "svelte/elements"; type $RestProps = SvelteHTMLElements["span"]; type $Props = { /** * Set to `true` for the item to fill the container instead of * stopping at 20rem. * @default false */ fullWidth?: boolean; /** * Set to `true` to remove the bottom margin, such as for an item in a * flex or grid layout that sets its own spacing. * @default false */ noMargin?: boolean; /** * Specify the file uploader status. * @default "uploading" */ status?: "uploading" | "edit" | "complete"; /** * Specify the size of button skeleton. * Also accepts Carbon v11's `"sm"` (`"small"`), `"md"` (`"field"`) and * `"lg"` (`"default"`). * @default "default" */ size?: "default" | "field" | "small" | "xs" | "sm" | "md" | "lg"; /** * Accessible label for the status icons. Forwarded to `Filename`. * Use a string, or a function with `{ file, fileName, status, invalid }` (`file` is always `undefined` here). * When omitted or the resolved value is blank after trim, `Filename` applies defaults. */ iconDescription?: string | undefined | ((ctx: { file?: File; fileName: string; status: "uploading" | "edit" | "complete"; invalid: boolean }) => string | undefined); /** * Set to `true` to indicate an invalid state * @default false */ invalid?: boolean; /** * Set to `true` to disable the remove button * @default false */ disabled?: boolean; /** * Specify the error subject text. * When `invalid`, the error is announced with `role="alert"` and * describes the remove button. * @default "" */ errorSubject?: string; /** * Specify the error body text * @default "" */ errorBody?: string; /** * Set an id for the top-level element * @default uniqueId() */ id?: string; /** * Specify the file uploader name * @default "" */ name?: string; /** * File size to show under the name. * A number is bytes, formatted with decimal units (1000 bytes = 1 kB). * A string is shown as-is; use `formatFileSize(bytes, { units: "binary" })` * for binary units or a localized size. * Omit to show the name only. */ fileSize?: number | string | undefined; [key: `data-${string}`]: unknown; }; export type FileUploaderItemProps = Omit<$RestProps, keyof $Props> & $Props; export default class FileUploaderItem extends SvelteComponentTyped< FileUploaderItemProps, { delete: CustomEvent; mouseenter: WindowEventMap["mouseenter"]; mouseleave: WindowEventMap["mouseleave"]; mouseover: WindowEventMap["mouseover"]; }, Record > {}