import { SvelteComponentTyped } from "svelte"; import type { SvelteHTMLElements } from "svelte/elements"; type $RestProps = SvelteHTMLElements["a"] & SvelteHTMLElements["button"]; type $Props = { /** * Specify the file name. * @default "" */ name?: string; /** * Specify the file URL. Without `href`, the item renders a button, such * as for a download that needs a signed URL or an authorized request in * `on:click`. */ href?: string | undefined; /** * Set the `download` attribute so the browser saves the file instead of * opening it. A string suggests a file name. Browsers apply it only to * same-origin and `blob:` or `data:` URLs. * @default true */ download?: boolean | 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, such as `formatFileSize(bytes, { units: "binary" })` * or "2.4 MB ยท PDF". * Omit to show the name only. */ fileSize?: number | string | undefined; /** * Specify an icon to show before the name, such as for the file type. */ icon?: Icon | undefined; /** * Specify what the download icon means, as text screen readers hear * before the file name and size. The icon itself is hidden from them. * @default "Download" */ iconDescription?: string; /** * Specify the size of the item. * Also accepts Carbon v11's `"sm"` (`"small"`), `"md"` (`"field"`) and * `"lg"` (`"default"`). * @default "default" */ size?: "default" | "field" | "small" | "xs" | "sm" | "md" | "lg"; /** * 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; /** * Set to `true` to disable the item, such as for an expired file. * @default false */ disabled?: boolean; /** * Obtain a reference to the anchor or button element. * @default null */ ref?: null | HTMLAnchorElement | HTMLButtonElement; [key: `data-${string}`]: unknown; }; export type FileDownloadItemProps = Omit<$RestProps, keyof $Props> & $Props; export default class FileDownloadItem extends SvelteComponentTyped< FileDownloadItemProps, { blur: WindowEventMap["blur"]; click: WindowEventMap["click"]; focus: WindowEventMap["focus"]; mouseenter: WindowEventMap["mouseenter"]; mouseleave: WindowEventMap["mouseleave"]; mouseover: WindowEventMap["mouseover"]; }, Record > {}