mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-16 10:51:06 +00:00
breaking(types): type arrays as read-only (#1335)
Closes #1259 * breaking(types): type arrays as read-only * Run "yarn build:docs" * test: assert read-only arrays
This commit is contained in:
parent
1a904dda36
commit
260bf4e040
34 changed files with 257 additions and 192 deletions
2
types/Checkbox/Checkbox.svelte.d.ts
vendored
2
types/Checkbox/Checkbox.svelte.d.ts
vendored
|
@ -18,7 +18,7 @@ export interface CheckboxProps {
|
|||
* Specify the bound group
|
||||
* @default undefined
|
||||
*/
|
||||
group?: any[];
|
||||
group?: ReadonlyArray<any>;
|
||||
|
||||
/**
|
||||
* Specify whether the checkbox is indeterminate
|
||||
|
|
2
types/ComboBox/ComboBox.svelte.d.ts
vendored
2
types/ComboBox/ComboBox.svelte.d.ts
vendored
|
@ -15,7 +15,7 @@ export interface ComboBoxProps
|
|||
* Set the combobox items
|
||||
* @default []
|
||||
*/
|
||||
items?: ComboBoxItem[];
|
||||
items?: ReadonlyArray<ComboBoxItem>;
|
||||
|
||||
/**
|
||||
* Override the display of a combobox item
|
||||
|
|
2
types/ContextMenu/ContextMenu.svelte.d.ts
vendored
2
types/ContextMenu/ContextMenu.svelte.d.ts
vendored
|
@ -8,7 +8,7 @@ export interface ContextMenuProps
|
|||
* If no element is specified, the context menu applies to the entire window
|
||||
* @default null
|
||||
*/
|
||||
target?: null | HTMLElement | HTMLElement[];
|
||||
target?: null | ReadonlyArray<null | HTMLElement>;
|
||||
|
||||
/**
|
||||
* Set to `true` to open the menu
|
||||
|
|
|
@ -5,7 +5,7 @@ export interface ContextMenuGroupProps {
|
|||
/**
|
||||
* @default []
|
||||
*/
|
||||
selectedIds?: string[];
|
||||
selectedIds?: ReadonlyArray<string>;
|
||||
|
||||
/**
|
||||
* Specify the label text
|
||||
|
|
12
types/DataTable/DataTable.svelte.d.ts
vendored
12
types/DataTable/DataTable.svelte.d.ts
vendored
|
@ -46,14 +46,14 @@ export interface DataTableProps
|
|||
* Specify the data table headers
|
||||
* @default []
|
||||
*/
|
||||
headers?: DataTableHeader[];
|
||||
headers?: ReadonlyArray<DataTableHeader>;
|
||||
|
||||
/**
|
||||
* Specify the rows the data table should render
|
||||
* keys defined in `headers` are used for the row ids
|
||||
* @default []
|
||||
*/
|
||||
rows?: DataTableRow[];
|
||||
rows?: ReadonlyArray<DataTableRow>;
|
||||
|
||||
/**
|
||||
* Set the size of the data table
|
||||
|
@ -102,13 +102,13 @@ export interface DataTableProps
|
|||
* Specify the row ids to be expanded
|
||||
* @default []
|
||||
*/
|
||||
expandedRowIds?: DataTableRowId[];
|
||||
expandedRowIds?: ReadonlyArray<DataTableRowId>;
|
||||
|
||||
/**
|
||||
* Specify the ids for rows that should not be expandable
|
||||
* @default []
|
||||
*/
|
||||
nonExpandableRowIds?: DataTableRowId[];
|
||||
nonExpandableRowIds?: ReadonlyArray<DataTableRowId>;
|
||||
|
||||
/**
|
||||
* Set to `true` for the radio selection variant
|
||||
|
@ -133,13 +133,13 @@ export interface DataTableProps
|
|||
* Specify the row ids to be selected
|
||||
* @default []
|
||||
*/
|
||||
selectedRowIds?: DataTableRowId[];
|
||||
selectedRowIds?: ReadonlyArray<DataTableRowId>;
|
||||
|
||||
/**
|
||||
* Specify the ids of rows that should not be selectable
|
||||
* @default []
|
||||
*/
|
||||
nonSelectableRowIds?: DataTableRowId[];
|
||||
nonSelectableRowIds?: ReadonlyArray<DataTableRowId>;
|
||||
|
||||
/**
|
||||
* Set to `true` to enable a sticky header
|
||||
|
|
|
@ -41,7 +41,7 @@ export interface DataTableSkeletonProps
|
|||
* Supersedes `columns` if value is a non-empty array
|
||||
* @default []
|
||||
*/
|
||||
headers?: string[] | Partial<DataTableHeader>[];
|
||||
headers?: ReadonlyArray<string | Partial<DataTableHeader>>;
|
||||
|
||||
/**
|
||||
* Set to `false` to hide the toolbar
|
||||
|
|
2
types/Dropdown/Dropdown.svelte.d.ts
vendored
2
types/Dropdown/Dropdown.svelte.d.ts
vendored
|
@ -17,7 +17,7 @@ export interface DropdownProps
|
|||
* Set the dropdown items
|
||||
* @default []
|
||||
*/
|
||||
items?: DropdownItem[];
|
||||
items?: ReadonlyArray<DropdownItem>;
|
||||
|
||||
/**
|
||||
* Override the display of a dropdown item
|
||||
|
|
10
types/FileUploader/FileUploader.svelte.d.ts
vendored
10
types/FileUploader/FileUploader.svelte.d.ts
vendored
|
@ -19,13 +19,13 @@ export interface FileUploaderProps
|
|||
* Specify the accepted file types
|
||||
* @default []
|
||||
*/
|
||||
accept?: string[];
|
||||
accept?: ReadonlyArray<string>;
|
||||
|
||||
/**
|
||||
* Obtain a reference to the uploaded files
|
||||
* @default []
|
||||
*/
|
||||
files?: File[];
|
||||
files?: ReadonlyArray<File>;
|
||||
|
||||
/**
|
||||
* Set to `true` to allow multiple files
|
||||
|
@ -73,9 +73,9 @@ export interface FileUploaderProps
|
|||
export default class FileUploader extends SvelteComponentTyped<
|
||||
FileUploaderProps,
|
||||
{
|
||||
add: CustomEvent<File[]>;
|
||||
remove: CustomEvent<File[]>;
|
||||
change: CustomEvent<File[]>;
|
||||
add: CustomEvent<ReadonlyArray<File>>;
|
||||
remove: CustomEvent<ReadonlyArray<File>>;
|
||||
change: CustomEvent<ReadonlyArray<File>>;
|
||||
click: WindowEventMap["click"];
|
||||
mouseover: WindowEventMap["mouseover"];
|
||||
mouseenter: WindowEventMap["mouseenter"];
|
||||
|
|
|
@ -7,13 +7,13 @@ export interface FileUploaderButtonProps
|
|||
* Specify the accepted file types
|
||||
* @default []
|
||||
*/
|
||||
accept?: string[];
|
||||
accept?: ReadonlyArray<string>;
|
||||
|
||||
/**
|
||||
* Obtain a reference to the uploaded files
|
||||
* @default []
|
||||
*/
|
||||
files?: File[];
|
||||
files?: ReadonlyArray<File>;
|
||||
|
||||
/**
|
||||
* Set to `true` to allow multiple files
|
||||
|
@ -79,7 +79,7 @@ export interface FileUploaderButtonProps
|
|||
export default class FileUploaderButton extends SvelteComponentTyped<
|
||||
FileUploaderButtonProps,
|
||||
{
|
||||
change: CustomEvent<File[]>;
|
||||
change: CustomEvent<ReadonlyArray<File>>;
|
||||
keydown: WindowEventMap["keydown"];
|
||||
click: WindowEventMap["click"];
|
||||
},
|
||||
|
|
|
@ -7,13 +7,13 @@ export interface FileUploaderDropContainerProps
|
|||
* Specify the accepted file types
|
||||
* @default []
|
||||
*/
|
||||
accept?: string[];
|
||||
accept?: ReadonlyArray<string>;
|
||||
|
||||
/**
|
||||
* Obtain a reference to the uploaded files
|
||||
* @default []
|
||||
*/
|
||||
files?: File[];
|
||||
files?: ReadonlyArray<File>;
|
||||
|
||||
/**
|
||||
* Set to `true` to allow multiple files
|
||||
|
@ -22,11 +22,11 @@ export interface FileUploaderDropContainerProps
|
|||
multiple?: boolean;
|
||||
|
||||
/**
|
||||
* Override the default behavior of validating uploaded files
|
||||
* The default behavior does not validate files
|
||||
* Override the default behavior of validating uploaded files.
|
||||
* By default, files are not validated
|
||||
* @default (files) => files
|
||||
*/
|
||||
validateFiles?: (files: File[]) => File[];
|
||||
validateFiles?: (files: ReadonlyArray<File>) => ReadonlyArray<File>;
|
||||
|
||||
/**
|
||||
* Specify the label text
|
||||
|
@ -74,8 +74,8 @@ export interface FileUploaderDropContainerProps
|
|||
export default class FileUploaderDropContainer extends SvelteComponentTyped<
|
||||
FileUploaderDropContainerProps,
|
||||
{
|
||||
add: CustomEvent<File[]>;
|
||||
change: CustomEvent<File[]>;
|
||||
add: CustomEvent<ReadonlyArray<File>>;
|
||||
change: CustomEvent<ReadonlyArray<File>>;
|
||||
dragover: WindowEventMap["dragover"];
|
||||
dragleave: WindowEventMap["dragleave"];
|
||||
drop: WindowEventMap["drop"];
|
||||
|
|
4
types/MultiSelect/MultiSelect.svelte.d.ts
vendored
4
types/MultiSelect/MultiSelect.svelte.d.ts
vendored
|
@ -17,7 +17,7 @@ export interface MultiSelectProps
|
|||
* Set the multiselect items
|
||||
* @default []
|
||||
*/
|
||||
items?: MultiSelectItem[];
|
||||
items?: ReadonlyArray<MultiSelectItem>;
|
||||
|
||||
/**
|
||||
* Override the display of a multiselect item
|
||||
|
@ -39,7 +39,7 @@ export interface MultiSelectProps
|
|||
* Set the selected ids
|
||||
* @default []
|
||||
*/
|
||||
selectedIds?: MultiSelectItemId[];
|
||||
selectedIds?: ReadonlyArray<MultiSelectItemId>;
|
||||
|
||||
/**
|
||||
* Specify the multiselect value
|
||||
|
|
2
types/Pagination/Pagination.svelte.d.ts
vendored
2
types/Pagination/Pagination.svelte.d.ts
vendored
|
@ -73,7 +73,7 @@ export interface PaginationProps
|
|||
* Specify the available page sizes
|
||||
* @default [10]
|
||||
*/
|
||||
pageSizes?: number[];
|
||||
pageSizes?: ReadonlyArray<number>;
|
||||
|
||||
/**
|
||||
* Set to `true` if the number of pages is unknown
|
||||
|
|
4
types/TreeView/TreeView.svelte.d.ts
vendored
4
types/TreeView/TreeView.svelte.d.ts
vendored
|
@ -30,13 +30,13 @@ export interface TreeViewProps
|
|||
* Set the node ids to be selected
|
||||
* @default []
|
||||
*/
|
||||
selectedIds?: TreeNodeId[];
|
||||
selectedIds?: ReadonlyArray<TreeNodeId>;
|
||||
|
||||
/**
|
||||
* Set the node ids to be expanded
|
||||
* @default []
|
||||
*/
|
||||
expandedIds?: TreeNodeId[];
|
||||
expandedIds?: ReadonlyArray<TreeNodeId>;
|
||||
|
||||
/**
|
||||
* Specify the TreeView size
|
||||
|
|
2
types/UIShell/HeaderSearch.svelte.d.ts
vendored
2
types/UIShell/HeaderSearch.svelte.d.ts
vendored
|
@ -31,7 +31,7 @@ export interface HeaderSearchProps
|
|||
* Render a list of search results
|
||||
* @default []
|
||||
*/
|
||||
results?: HeaderSearchResult[];
|
||||
results?: ReadonlyArray<HeaderSearchResult>;
|
||||
|
||||
/**
|
||||
* Specify the selected result index
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue