mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-14 18:01:06 +00:00
fix(file-uploader): update clearFiles
accessor description (#1122)
The `clearFiles` prop description currently reads "Override the default behavior of clearing the array of uploaded files." This is misleading as `clearFiles` is a component accessor, not a `let` prop.
This commit is contained in:
parent
cd687f0e1b
commit
2f3cff2942
5 changed files with 21 additions and 16 deletions
|
@ -1261,19 +1261,19 @@ None.
|
|||
|
||||
### Props
|
||||
|
||||
| Prop name | Kind | Reactive | Type | Default value | Description |
|
||||
| :--------------- | :----------------- | :------- | :----------------------------------------------------------------------------------------- | --------------------------------------- | --------------------------------------------------------------------- |
|
||||
| files | <code>let</code> | Yes | <code>File[]</code> | <code>[]</code> | Obtain the uploaded file names |
|
||||
| status | <code>let</code> | No | <code>"uploading" | "edit" | "complete"</code> | <code>"uploading"</code> | Specify the file uploader status |
|
||||
| accept | <code>let</code> | No | <code>string[]</code> | <code>[]</code> | Specify the accepted file types |
|
||||
| multiple | <code>let</code> | No | <code>boolean</code> | <code>false</code> | Set to `true` to allow multiple files |
|
||||
| clearFiles | <code>const</code> | No | <code>() => void</code> | <code>() => { files = []; }</code> | Override the default behavior of clearing the array of uploaded files |
|
||||
| labelDescription | <code>let</code> | No | <code>string</code> | <code>""</code> | Specify the label description |
|
||||
| labelTitle | <code>let</code> | No | <code>string</code> | <code>""</code> | Specify the label title |
|
||||
| kind | <code>let</code> | No | <code>"primary" | "secondary" | "tertiary" | "ghost" | "danger"</code> | <code>"primary"</code> | Specify the kind of file uploader button |
|
||||
| buttonLabel | <code>let</code> | No | <code>string</code> | <code>""</code> | Specify the button label |
|
||||
| iconDescription | <code>let</code> | No | <code>string</code> | <code>"Provide icon description"</code> | Specify the ARIA label used for the status icons |
|
||||
| name | <code>let</code> | No | <code>string</code> | <code>""</code> | Specify a name attribute for the file button uploader input |
|
||||
| Prop name | Kind | Reactive | Type | Default value | Description |
|
||||
| :--------------- | :----------------- | :------- | :----------------------------------------------------------------------------------------- | --------------------------------------- | ----------------------------------------------------------- |
|
||||
| files | <code>let</code> | Yes | <code>File[]</code> | <code>[]</code> | Obtain the uploaded file names |
|
||||
| status | <code>let</code> | No | <code>"uploading" | "edit" | "complete"</code> | <code>"uploading"</code> | Specify the file uploader status |
|
||||
| accept | <code>let</code> | No | <code>string[]</code> | <code>[]</code> | Specify the accepted file types |
|
||||
| multiple | <code>let</code> | No | <code>boolean</code> | <code>false</code> | Set to `true` to allow multiple files |
|
||||
| clearFiles | <code>const</code> | No | <code>() => void</code> | <code>() => { files = []; }</code> | Programmatically clear the uploaded files |
|
||||
| labelDescription | <code>let</code> | No | <code>string</code> | <code>""</code> | Specify the label description |
|
||||
| labelTitle | <code>let</code> | No | <code>string</code> | <code>""</code> | Specify the label title |
|
||||
| kind | <code>let</code> | No | <code>"primary" | "secondary" | "tertiary" | "ghost" | "danger"</code> | <code>"primary"</code> | Specify the kind of file uploader button |
|
||||
| buttonLabel | <code>let</code> | No | <code>string</code> | <code>""</code> | Specify the button label |
|
||||
| iconDescription | <code>let</code> | No | <code>string</code> | <code>"Provide icon description"</code> | Specify the ARIA label used for the status icons |
|
||||
| name | <code>let</code> | No | <code>string</code> | <code>""</code> | Specify a name attribute for the file button uploader input |
|
||||
|
||||
### Slots
|
||||
|
||||
|
|
|
@ -3503,7 +3503,7 @@
|
|||
{
|
||||
"name": "clearFiles",
|
||||
"kind": "const",
|
||||
"description": "Override the default behavior of clearing the array of uploaded files",
|
||||
"description": "Programmatically clear the uploaded files",
|
||||
"type": "() => void",
|
||||
"value": "() => { files = []; }",
|
||||
"isFunction": true,
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
export let multiple = false;
|
||||
|
||||
/**
|
||||
* Override the default behavior of clearing the array of uploaded files
|
||||
* Programmatically clear the uploaded files
|
||||
* @type {() => void}
|
||||
*/
|
||||
export const clearFiles = () => {
|
||||
|
|
|
@ -6,6 +6,10 @@
|
|||
FileUploaderItem,
|
||||
FileUploaderSkeleton,
|
||||
} from "../types";
|
||||
|
||||
let fileUploader: FileUploader;
|
||||
|
||||
$: fileUploader?.clearFiles();
|
||||
</script>
|
||||
|
||||
<FileUploaderButton
|
||||
|
@ -16,6 +20,7 @@
|
|||
/>
|
||||
|
||||
<FileUploader
|
||||
bind:this="{fileUploader}"
|
||||
multiple
|
||||
labelTitle="Upload files"
|
||||
buttonLabel="Add files"
|
||||
|
|
2
types/FileUploader/FileUploader.svelte.d.ts
vendored
2
types/FileUploader/FileUploader.svelte.d.ts
vendored
|
@ -79,7 +79,7 @@ export default class FileUploader extends SvelteComponentTyped<
|
|||
{}
|
||||
> {
|
||||
/**
|
||||
* Override the default behavior of clearing the array of uploaded files
|
||||
* Programmatically clear the uploaded files
|
||||
*/
|
||||
clearFiles: () => void;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue