carbon-components-svelte
Version:
Svelte implementation of the Carbon Design System
77 lines (64 loc) • 1.83 kB
TypeScript
import { SvelteComponentTyped } from "svelte";
import type { SvelteHTMLElements } from "svelte/elements";
type $RestProps = SvelteHTMLElements["span"];
type $Props = {
/**
* Specify the file uploader status.
* @default "uploading"
*/
status?: "uploading" | "edit" | "complete";
/**
* Specify the size of button skeleton.
* @default "default"
*/
size?: "default" | "field" | "small";
/**
* 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.
* @default undefined
*/
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;
/**
* Specify the error subject text
* @default ""
*/
errorSubject?: string;
/**
* Specify the error body text
* @default ""
*/
errorBody?: string;
/**
* Set an id for the top-level element
* @default `ccs-${Math.random().toString(36)}`
*/
id?: string;
/**
* Specify the file uploader name
* @default ""
*/
name?: string;
[key: `data-${string}`]: unknown;
};
export type FileUploaderItemProps = Omit<$RestProps, keyof $Props> & $Props;
export default class FileUploaderItem extends SvelteComponentTyped<
FileUploaderItemProps,
{
delete: CustomEvent<string>;
mouseenter: WindowEventMap["mouseenter"];
mouseleave: WindowEventMap["mouseleave"];
mouseover: WindowEventMap["mouseover"];
},
Record<string, never>
> {}