From 2f3cff294228d29788f59d5450fe9de5606b0734 Mon Sep 17 00:00:00 2001 From: metonym Date: Mon, 21 Feb 2022 09:24:50 -0800 Subject: [PATCH] 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. --- COMPONENT_INDEX.md | 26 ++++++++++----------- docs/src/COMPONENT_API.json | 2 +- src/FileUploader/FileUploader.svelte | 2 +- tests/FileUploader.test.svelte | 5 ++++ types/FileUploader/FileUploader.svelte.d.ts | 2 +- 5 files changed, 21 insertions(+), 16 deletions(-) diff --git a/COMPONENT_INDEX.md b/COMPONENT_INDEX.md index 49d2ea44..552489bb 100644 --- a/COMPONENT_INDEX.md +++ b/COMPONENT_INDEX.md @@ -1261,19 +1261,19 @@ None. ### Props -| Prop name | Kind | Reactive | Type | Default value | Description | -| :--------------- | :----------------- | :------- | :----------------------------------------------------------------------------------------- | --------------------------------------- | --------------------------------------------------------------------- | -| files | let | Yes | File[] | [] | Obtain the uploaded file names | -| status | let | No | "uploading" | "edit" | "complete" | "uploading" | Specify the file uploader status | -| accept | let | No | string[] | [] | Specify the accepted file types | -| multiple | let | No | boolean | false | Set to `true` to allow multiple files | -| clearFiles | const | No | () => void | () => { files = []; } | Override the default behavior of clearing the array of uploaded files | -| labelDescription | let | No | string | "" | Specify the label description | -| labelTitle | let | No | string | "" | Specify the label title | -| kind | let | No | "primary" | "secondary" | "tertiary" | "ghost" | "danger" | "primary" | Specify the kind of file uploader button | -| buttonLabel | let | No | string | "" | Specify the button label | -| iconDescription | let | No | string | "Provide icon description" | Specify the ARIA label used for the status icons | -| name | let | No | string | "" | Specify a name attribute for the file button uploader input | +| Prop name | Kind | Reactive | Type | Default value | Description | +| :--------------- | :----------------- | :------- | :----------------------------------------------------------------------------------------- | --------------------------------------- | ----------------------------------------------------------- | +| files | let | Yes | File[] | [] | Obtain the uploaded file names | +| status | let | No | "uploading" | "edit" | "complete" | "uploading" | Specify the file uploader status | +| accept | let | No | string[] | [] | Specify the accepted file types | +| multiple | let | No | boolean | false | Set to `true` to allow multiple files | +| clearFiles | const | No | () => void | () => { files = []; } | Programmatically clear the uploaded files | +| labelDescription | let | No | string | "" | Specify the label description | +| labelTitle | let | No | string | "" | Specify the label title | +| kind | let | No | "primary" | "secondary" | "tertiary" | "ghost" | "danger" | "primary" | Specify the kind of file uploader button | +| buttonLabel | let | No | string | "" | Specify the button label | +| iconDescription | let | No | string | "Provide icon description" | Specify the ARIA label used for the status icons | +| name | let | No | string | "" | Specify a name attribute for the file button uploader input | ### Slots diff --git a/docs/src/COMPONENT_API.json b/docs/src/COMPONENT_API.json index d908e0c6..f4b8198c 100644 --- a/docs/src/COMPONENT_API.json +++ b/docs/src/COMPONENT_API.json @@ -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, diff --git a/src/FileUploader/FileUploader.svelte b/src/FileUploader/FileUploader.svelte index f1d5f415..fcb9c98a 100644 --- a/src/FileUploader/FileUploader.svelte +++ b/src/FileUploader/FileUploader.svelte @@ -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 = () => { diff --git a/tests/FileUploader.test.svelte b/tests/FileUploader.test.svelte index a2eb96c5..e658fed8 100644 --- a/tests/FileUploader.test.svelte +++ b/tests/FileUploader.test.svelte @@ -6,6 +6,10 @@ FileUploaderItem, FileUploaderSkeleton, } from "../types"; + + let fileUploader: FileUploader; + + $: fileUploader?.clearFiles(); { /** - * Override the default behavior of clearing the array of uploaded files + * Programmatically clear the uploaded files */ clearFiles: () => void; }