fix(types): upgrade sveld and type constant props as accessors (#742)

This commit is contained in:
Eric Liu 2021-07-11 07:21:50 -07:00 committed by GitHub
commit 54e1e07872
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 63 additions and 61 deletions

View file

@ -16,13 +16,6 @@ export interface BreakpointProps {
* @default { sm: false, md: false, lg: false, xlg: false, max: false, }
*/
sizes?: Record<BreakpointSize, boolean>;
/**
* Reference the Carbon grid breakpoints
* @constant
* @default { sm: 320, md: 672, lg: 1056, xlg: 1312, max: 1584, }
*/
breakpoints?: { sm: 320; md: 672; lg: 1056; xlg: 1312; max: 1584 };
}
export default class Breakpoint extends SvelteComponentTyped<
@ -34,4 +27,11 @@ export default class Breakpoint extends SvelteComponentTyped<
}>;
},
{ default: { size: BreakpointSize; sizes: Record<BreakpointSize, boolean> } }
> {}
> {
/**
* Reference the Carbon grid breakpoints
* @constant
* @default { sm: 320, md: 672, lg: 1056, xlg: 1312, max: 1584, }
*/
breakpoints: Record<BreakpointSize, BreakpointValue>;
}

View file

@ -27,13 +27,6 @@ export interface FileUploaderProps
*/
multiple?: boolean;
/**
* Override the default behavior of clearing the array of uploaded files
* @constant
* @default () => { files = []; }
*/
clearFiles?: () => void;
/**
* Specify the label description
* @default ""
@ -84,4 +77,11 @@ export default class FileUploader extends SvelteComponentTyped<
keydown: WindowEventMap["keydown"];
},
{}
> {}
> {
/**
* Override the default behavior of clearing the array of uploaded files
* @constant
* @default () => { files = []; }
*/
clearFiles: () => void;
}

View file

@ -44,17 +44,17 @@ export interface ImageLoaderProps
* @default false
*/
fadeIn?: boolean;
/**
* Method invoked to load the image provided a `src` value
* @constant
* @default (url) => { if (image != null) image = null; loaded = false; error = false; image = new Image(); image.src = url || src; image.onload = () => (loaded = true); image.onerror = () => (error = true); }
*/
loadImage?: (url?: string) => void;
}
export default class ImageLoader extends SvelteComponentTyped<
ImageLoaderProps,
{ load: CustomEvent<any>; error: CustomEvent<any> },
{ error: {}; loading: {} }
> {}
> {
/**
* Method invoked to load the image provided a `src` value
* @constant
* @default (url) => { if (image != null) image = null; loaded = false; error = false; image = new Image(); image.src = url || src; image.onload = () => (loaded = true); image.onerror = () => (error = true); }
*/
loadImage: (url?: string) => void;
}

View file

@ -23,13 +23,6 @@ export interface ListBoxFieldProps
*/
tabindex?: string;
/**
* Default translation ids
* @constant
* @default { close: "close", open: "open" }
*/
translationIds?: { close: "close"; open: "open" };
/**
* Override the default translation ids
* @default (id) => defaultTranslations[id]
@ -61,4 +54,11 @@ export default class ListBoxField extends SvelteComponentTyped<
blur: WindowEventMap["blur"];
},
{ default: {} }
> {}
> {
/**
* Default translation ids
* @constant
* @default { close: "close", open: "open" }
*/
translationIds: { close: "close"; open: "open" };
}

View file

@ -11,13 +11,6 @@ export interface ListBoxMenuIconProps
*/
open?: boolean;
/**
* Default translation ids
* @constant
* @default { close: "close", open: "open" }
*/
translationIds?: { close: "close"; open: "open" };
/**
* Override the default translation ids
* @default (id) => defaultTranslations[id]
@ -29,4 +22,11 @@ export default class ListBoxMenuIcon extends SvelteComponentTyped<
ListBoxMenuIconProps,
{ click: WindowEventMap["click"] },
{}
> {}
> {
/**
* Default translation ids
* @constant
* @default { close: "close", open: "open" }
*/
translationIds: { close: "close"; open: "open" };
}

View file

@ -16,13 +16,6 @@ export interface ListBoxSelectionProps
*/
disabled?: boolean;
/**
* Default translation ids
* @constant
* @default { clearAll: "clearAll", clearSelection: "clearSelection", }
*/
translationIds?: { clearAll: "clearAll"; clearSelection: "clearSelection" };
/**
* Override the default translation ids
* @default (id) => defaultTranslations[id]
@ -40,4 +33,11 @@ export default class ListBoxSelection extends SvelteComponentTyped<
ListBoxSelectionProps,
{ clear: CustomEvent<any> },
{}
> {}
> {
/**
* Default translation ids
* @constant
* @default { clearAll: "clearAll", clearSelection: "clearSelection", }
*/
translationIds: { clearAll: "clearAll"; clearSelection: "clearSelection" };
}

View file

@ -25,11 +25,13 @@ export default class LocalStorage extends SvelteComponentTyped<
> {
/**
* Remove the persisted key value from the browser's local storage
* @default () => { localStorage.removeItem(key); }
*/
clearItem: () => void;
/**
* Clear all key values from the browser's local storage
* @default () => { localStorage.clear(); }
*/
clearAll: () => void;
}

View file

@ -122,13 +122,6 @@ export interface NumberInputProps
*/
translateWithId?: (id: NumberInputTranslationId) => string;
/**
* Default translation ids
* @constant
* @default { increment: "increment", decrement: "decrement", }
*/
translationIds?: { increment: "increment"; decrement: "decrement" };
/**
* Set an id for the input element
* @default "ccs-" + Math.random().toString(36)
@ -158,4 +151,11 @@ export default class NumberInput extends SvelteComponentTyped<
input: WindowEventMap["input"];
},
{ label: {} }
> {}
> {
/**
* Default translation ids
* @constant
* @default { increment: "increment", decrement: "decrement", }
*/
translationIds: { increment: "increment"; decrement: "decrement" };
}