@nextcloud/vue
Version:
Nextcloud vue components
140 lines (139 loc) • 3.79 kB
TypeScript
import { Slot } from 'vue';
export interface FilePickerItem {
/**
* SVG icon (as string) for the action
*/
iconSvg: string;
/**
* Label of the action
*/
label: string;
/**
* Callback when the action is clicked
*/
onClick: () => void;
}
export interface FilePickerItemGroup {
/**
* Caption for the action group
*/
caption: string;
/**
* Actions within this group
*/
actions: FilePickerItem[];
}
type __VLS_Props = {
/**
* File types to accept
*/
accept?: string[];
/**
* Optional menu caption to be shown above the actions
*/
actionCaption?: string;
/**
* Additional actions to be shown within the picker menu
*/
actions?: FilePickerItem[] | FilePickerItemGroup[];
/**
* Allow picking a directory
*/
directory?: boolean;
/**
* Disable picking files and only allow picking a directory
*/
directoryOnly?: boolean;
/**
* Disabled state of the picker
*/
disabled?: boolean;
/**
* If set then the label is only used for accessibility but not shown visually
*/
iconOnly?: boolean;
/**
* Label of the picker
*
* @default 'Pick file' or 'Pick files' depending on `multiple`
*/
label?: string;
/**
* If set then the picker will be set into a loading state.
* This means the picker is disabled, a loading spinner is shown and the label is adjusted.
*/
loading?: boolean;
/**
* Can the user pick multiple files.
* This is ignored when picking folder (by browser limitations).
*/
multiple?: boolean;
/**
* The variant of the button
*/
variant?: 'primary' | 'secondary' | 'tertiary';
};
/**
* Trigger file picker
*
* @param uploadFolders - Whether to upload folders or files
*/
declare function triggerPickFiles(uploadFolders: boolean): void;
/**
* Reset the picker state of the currently selected files.
*/
declare function reset(): void;
declare function __VLS_template(): {
attrs: Partial<{}>;
slots: Readonly<{
/**
* Optional custom icon for the picker menu
*/
icon?: Slot;
/**
* Optional content to be shown in the picker.
* This can be used e.g. for a progress bar or similar.
*/
default?: Slot;
}> & {
/**
* Optional custom icon for the picker menu
*/
icon?: Slot;
/**
* Optional content to be shown in the picker.
* This can be used e.g. for a progress bar or similar.
*/
default?: Slot;
};
refs: {
form: HTMLFormElement;
input: HTMLInputElement;
};
rootEl: HTMLFormElement;
};
type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
declare const __VLS_component: import('vue').DefineComponent<__VLS_Props, {
reset: typeof reset;
triggerPickFiles: typeof triggerPickFiles;
}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
pick: (files: File[]) => any;
}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{
onPick?: ((files: File[]) => any) | undefined;
}>, {
label: string;
variant: "primary" | "secondary" | "tertiary";
actions: FilePickerItem[] | FilePickerItemGroup[];
accept: string[];
actionCaption: string;
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {
form: HTMLFormElement;
input: HTMLInputElement;
}, HTMLFormElement>;
declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
export default _default;
type __VLS_WithTemplateSlots<T, S> = T & {
new (): {
$slots: S;
};
};