import type { ComponentClass } from "@/types"; import type { AriaAttributes, InputHTMLAttributes } from "vue"; type UploadType = IsMultiple extends true ? T[] : T; /** * Native `` attributes exposed as typed component props, * including all `aria-*` attributes. */ export type UploadNativeProps = { /** Same as native required */ required?: InputHTMLAttributes["required"]; /** Same as native name */ name?: InputHTMLAttributes["name"]; /** Same as native form */ form?: InputHTMLAttributes["form"]; } & AriaAttributes; export type UploadProps< T extends object | typeof File, IsMultiple extends boolean = boolean, > = { /** Override existing theme classes completely */ override?: boolean; /** * The input value state, use v-model to make it two-way binding * @type object | File */ modelValue?: UploadType; /** Same as native, also push new item to v-model instead of replacing */ multiple?: IsMultiple; /** * Color variant of the control * @values primary, info, success, warning, danger, and any other custom color */ variant?: string; /** Same as native disabled */ disabled?: boolean; /** Upload will be expanded (full-width) */ expanded?: boolean; /** Same as native accept */ accept?: string; /** Accepts drag & drop and change its style */ dragDrop?: boolean; /** Replace last chosen files every time (like native file input element) */ native?: boolean; /** Enable HTML 5 native validation */ useHtml5Validation?: boolean; /** Custom HTML 5 validation error to set on the form control */ customValidity?: | string | (( currentValue: UploadType | null | undefined, state: ValidityState, ) => string); } & UploadClasses; // class props (will not be displayed in the docs) export type UploadClasses = Partial<{ /** Class of the root element */ rootClass: ComponentClass; /** Class of the root element when expanded */ expandedClass: ComponentClass; /** Class of the root element when disabled */ disabledClass: ComponentClass; /** Class of the root element with variant */ variantClass: ComponentClass; /** Class of the drag/drop container element */ dragzoneClass: ComponentClass; /** Class of the drag/drop container element when hovered with a file*/ dragzoneHoveredClass: ComponentClass; }>;