refactor(types): shorten ref, id JSDocs, use CarbonIcon type, export component props

This commit is contained in:
Eric Liu 2020-11-06 11:30:46 -08:00
commit 75d4b4cf03
219 changed files with 5168 additions and 5259 deletions

View file

@ -2,76 +2,77 @@
type Files = string[];
export interface FileUploaderProps extends svelte.JSX.HTMLAttributes<HTMLElementTagNameMap["div"]> {
/**
* Specify the file uploader status
* @default "uploading"
*/
status?: "uploading" | "edit" | "complete";
/**
* Specify the accepted file types
* @default []
*/
accept?: Files;
/**
* Obtain the uploaded file names
* @default []
*/
files?: Files;
/**
* Set to `true` to allow multiple files
* @default false
*/
multiple?: boolean;
/**
* Override the default behavior of clearing the array of uploaded files
* @constant
* @default () => { files = []; }
*/
clearFiles?: () => void;
/**
* Specify the label description
* @default ""
*/
labelDescription?: string;
/**
* Specify the label title
* @default ""
*/
labelTitle?: string;
/**
* Specify the kind of file uploader button
* @default "primary"
*/
kind?: "primary" | "secondary" | "tertiary" | "ghost" | "danger";
/**
* Specify the button label
* @default ""
*/
buttonLabel?: string;
/**
* Specify the ARIA label used for the status icons
* @default "Provide icon description"
*/
iconDescription?: string;
/**
* Specify a name attribute for the file button uploader input
* @default ""
*/
name?: string;
}
export default class FileUploader {
$$prop_def: svelte.JSX.HTMLAttributes<HTMLElementTagNameMap["div"]> & {
/**
* Specify the file uploader status
* @default "uploading"
*/
status?: "uploading" | "edit" | "complete";
/**
* Specify the accepted file types
* @default []
*/
accept?: Files;
/**
* Obtain the uploaded file names
* @default []
*/
files?: Files;
/**
* Set to `true` to allow multiple files
* @default false
*/
multiple?: boolean;
/**
* Override the default behavior of clearing the array of uploaded files
* @constant
* @default () => { files = []; }
*/
clearFiles?: () => void;
/**
* Specify the label description
* @default ""
*/
labelDescription?: string;
/**
* Specify the label title
* @default ""
*/
labelTitle?: string;
/**
* Specify the kind of file uploader button
* @default "primary"
*/
kind?: "primary" | "secondary" | "tertiary" | "ghost" | "danger";
/**
* Specify the button label
* @default ""
*/
buttonLabel?: string;
/**
* Specify the ARIA label used for the status icons
* @default "Provide icon description"
*/
iconDescription?: string;
/**
* Specify a name attribute for the file button uploader input
* @default ""
*/
name?: string;
};
$$prop_def: FileUploaderProps;
$$slot_def: {};
$on(eventname: "add", cb: (event: CustomEvent<Files>) => void): () => void;

View file

@ -2,74 +2,76 @@
type Files = string[];
export interface FileUploaderButtonProps extends svelte.JSX.HTMLAttributes<HTMLElementTagNameMap["input"]> {
/**
* Specify the accepted file types
* @default []
*/
accept?: Files;
/**
* Set to `true` to allow multiple files
* @default false
*/
multiple?: boolean;
/**
* Set to `true` to disable the input
* @default false
*/
disabled?: boolean;
/**
* Set to `true` to disable label changes
* @default false
*/
disableLabelChanges?: boolean;
/**
* Specify the kind of file uploader button
* @default "primary"
*/
kind?: "primary" | "secondary" | "tertiary" | "ghost" | "danger";
/**
* Specify the label text
* @default "Add file"
*/
labelText?: string;
/**
* Specify the label role
* @default "button"
*/
role?: string;
/**
* Specify `tabindex` attribute
* @default "0"
*/
tabindex?: string;
/**
* Set an id for the input element
* @default "ccs-" + Math.random().toString(36)
*/
id?: string;
/**
* Specify a name attribute for the input
* @default ""
*/
name?: string;
/**
* Obtain a reference to the input HTML element
* @default null
*/
ref?: null | HTMLInputElement;
}
export default class FileUploaderButton {
$$prop_def: svelte.JSX.HTMLAttributes<HTMLElementTagNameMap["input"]> & {
/**
* Specify the accepted file types
* @default []
*/
accept?: Files;
/**
* Set to `true` to allow multiple files
* @default false
*/
multiple?: boolean;
/**
* Set to `true` to disable the input
* @default false
*/
disabled?: boolean;
/**
* Set to `true` to disable label changes
* @default false
*/
disableLabelChanges?: boolean;
/**
* Specify the kind of file uploader button
* @default "primary"
*/
kind?: "primary" | "secondary" | "tertiary" | "ghost" | "danger";
/**
* Specify the label text
* @default "Add file"
*/
labelText?: string;
/**
* Specify the label role
* @default "button"
*/
role?: string;
/**
* Specify `tabindex` attribute
* @default "0"
*/
tabindex?: string;
/**
* Set an id for the input element
*/
id?: string;
/**
* Specify a name attribute for the input
* @default ""
*/
name?: string;
/**
* Obtain a reference to the input HTML element
* @default null
*/
ref?: null | HTMLInputElement;
};
$$prop_def: FileUploaderButtonProps;
$$slot_def: {};
$on(eventname: "keydown", cb: (event: WindowEventMap["keydown"]) => void): () => void;

View file

@ -2,69 +2,71 @@
type Files = string[];
export interface FileUploaderDropContainerProps extends svelte.JSX.HTMLAttributes<HTMLElementTagNameMap["div"]> {
/**
* Specify the accepted file types
* @default []
*/
accept?: Files;
/**
* Set to `true` to allow multiple files
* @default false
*/
multiple?: boolean;
/**
* Override the default behavior of validating uploaded files
* The default behavior does not validate files
* @default (files) => files
*/
validateFiles?: (files: Files) => Files;
/**
* Specify the label text
* @default "Add file"
*/
labelText?: string;
/**
* Specify the `role` attribute of the drop container
* @default "button"
*/
role?: string;
/**
* Set to `true` to disable the input
* @default false
*/
disabled?: boolean;
/**
* Specify `tabindex` attribute
* @default "0"
*/
tabindex?: string;
/**
* Set an id for the input element
* @default "ccs-" + Math.random().toString(36)
*/
id?: string;
/**
* Specify a name attribute for the input
* @default ""
*/
name?: string;
/**
* Obtain a reference to the input HTML element
* @default null
*/
ref?: null | HTMLInputElement;
}
export default class FileUploaderDropContainer {
$$prop_def: svelte.JSX.HTMLAttributes<HTMLElementTagNameMap["div"]> & {
/**
* Specify the accepted file types
* @default []
*/
accept?: Files;
/**
* Set to `true` to allow multiple files
* @default false
*/
multiple?: boolean;
/**
* Override the default behavior of validating uploaded files
* The default behavior does not validate files
* @default (files) => files
*/
validateFiles?: (files: Files) => Files;
/**
* Specify the label text
* @default "Add file"
*/
labelText?: string;
/**
* Specify the `role` attribute of the drop container
* @default "button"
*/
role?: string;
/**
* Set to `true` to disable the input
* @default false
*/
disabled?: boolean;
/**
* Specify `tabindex` attribute
* @default "0"
*/
tabindex?: string;
/**
* Set an id for the input element
*/
id?: string;
/**
* Specify a name attribute for the input
* @default ""
*/
name?: string;
/**
* Obtain a reference to the input HTML element
* @default null
*/
ref?: null | HTMLInputElement;
};
$$prop_def: FileUploaderDropContainerProps;
$$slot_def: {};
$on(eventname: "add", cb: (event: CustomEvent<Files>) => void): () => void;

View file

@ -1,49 +1,51 @@
/// <reference types="svelte" />
export interface FileUploaderItemProps extends svelte.JSX.HTMLAttributes<HTMLElementTagNameMap["span"]> {
/**
* Specify the file uploader status
* @default "uploading"
*/
status?: "uploading" | "edit" | "complete";
/**
* Specify the ARIA label used for the status icons
* @default ""
*/
iconDescription?: string;
/**
* 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;
}
export default class FileUploaderItem {
$$prop_def: svelte.JSX.HTMLAttributes<HTMLElementTagNameMap["span"]> & {
/**
* Specify the file uploader status
* @default "uploading"
*/
status?: "uploading" | "edit" | "complete";
/**
* Specify the ARIA label used for the status icons
* @default ""
*/
iconDescription?: string;
/**
* 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
*/
id?: string;
/**
* Specify the file uploader name
* @default ""
*/
name?: string;
};
$$prop_def: FileUploaderItemProps;
$$slot_def: {};
$on(eventname: "delete", cb: (event: CustomEvent<string>) => void): () => void;

View file

@ -1,8 +1,9 @@
/// <reference types="svelte" />
export default class FileUploaderSkeleton {
$$prop_def: svelte.JSX.HTMLAttributes<HTMLElementTagNameMap["div"]> & {};
export interface FileUploaderSkeletonProps extends svelte.JSX.HTMLAttributes<HTMLElementTagNameMap["div"]> {}
export default class FileUploaderSkeleton {
$$prop_def: FileUploaderSkeletonProps;
$$slot_def: {};
$on(eventname: "click", cb: (event: WindowEventMap["click"]) => void): () => void;

View file

@ -1,26 +1,27 @@
/// <reference types="svelte" />
export interface FilenameProps {
/**
* Specify the file name status
* @default "uploading"
*/
status?: "uploading" | "edit" | "complete";
/**
* Specify the ARIA label used for the status icons
* @default ""
*/
iconDescription?: string;
/**
* Set to `true` to indicate an invalid state
* @default false
*/
invalid?: boolean;
}
export default class Filename {
$$prop_def: {
/**
* Specify the file name status
* @default "uploading"
*/
status?: "uploading" | "edit" | "complete";
/**
* Specify the ARIA label used for the status icons
* @default ""
*/
iconDescription?: string;
/**
* Set to `true` to indicate an invalid state
* @default false
*/
invalid?: boolean;
};
$$prop_def: FilenameProps;
$$slot_def: {};
$on(eventname: "click", cb: (event: WindowEventMap["click"]) => void): () => void;