@gradio/file 0.4.7 → 0.4.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +19 -1
- package/Example.svelte +2 -2
- package/FileUpload.stories.svelte +64 -0
- package/package.json +7 -7
- package/shared/FileUpload.svelte +1 -1
package/CHANGELOG.md
CHANGED
@@ -1,10 +1,28 @@
|
|
1
1
|
# @gradio/file
|
2
2
|
|
3
|
+
## 0.4.9
|
4
|
+
|
5
|
+
### Fixes
|
6
|
+
|
7
|
+
- [#7192](https://github.com/gradio-app/gradio/pull/7192) [`8dd6f4b`](https://github.com/gradio-app/gradio/commit/8dd6f4bc1901792f05cd59e86df7b1dbab692739) - Handle the case where examples is `null` for all components. Thanks [@abidlabs](https://github.com/abidlabs)!
|
8
|
+
- [#7221](https://github.com/gradio-app/gradio/pull/7221) [`cae05c0`](https://github.com/gradio-app/gradio/commit/cae05c05ecde56c4d92c6b5ed8d13353505cbd14) - Fix single file upload display. Thanks [@freddyaboulton](https://github.com/freddyaboulton)!
|
9
|
+
|
10
|
+
## 0.4.8
|
11
|
+
|
12
|
+
### Patch Changes
|
13
|
+
|
14
|
+
- Updated dependencies [[`5727b92`](https://github.com/gradio-app/gradio/commit/5727b92abc8a00a675bfc0a921b38de771af947b), [`bc2cdc1`](https://github.com/gradio-app/gradio/commit/bc2cdc1df95b38025486cf76df4a494b66d98585), [`c60ad4d`](https://github.com/gradio-app/gradio/commit/c60ad4d34ab5b56a89bf6796822977e51e7a4a32), [`be56c76`](https://github.com/gradio-app/gradio/commit/be56c76c7b5d2814ea8239c7dbeddc4b1d3701c4), [`8c355a4`](https://github.com/gradio-app/gradio/commit/8c355a47844296e3aab250fe61e2ecc706122e78)]:
|
15
|
+
- @gradio/utils@0.2.1
|
16
|
+
- @gradio/upload@0.7.0
|
17
|
+
- @gradio/atoms@0.5.0
|
18
|
+
- @gradio/wasm@0.5.1
|
19
|
+
- @gradio/statustracker@0.4.4
|
20
|
+
|
3
21
|
## 0.4.7
|
4
22
|
|
5
23
|
### Fixes
|
6
24
|
|
7
|
-
- [#6980](https://github.com/gradio-app/gradio/pull/6980) [`523b6bc`](https://github.com/gradio-app/gradio/commit/523b6bc534e221b028a3ea3f274c7466fe242d5a) - `gr.update(value=[])` for `gr.File()` clears it.
|
25
|
+
- [#6980](https://github.com/gradio-app/gradio/pull/6980) [`523b6bc`](https://github.com/gradio-app/gradio/commit/523b6bc534e221b028a3ea3f274c7466fe242d5a) - `gr.update(value=[])` for `gr.File()` clears it. Thanks [@dawoodkhan82](https://github.com/dawoodkhan82)!
|
8
26
|
|
9
27
|
## 0.4.6
|
10
28
|
|
package/Example.svelte
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
<script lang="ts">
|
2
2
|
import type { FileData } from "@gradio/client";
|
3
3
|
|
4
|
-
export let value: FileData;
|
4
|
+
export let value: FileData | null;
|
5
5
|
export let type: "gallery" | "table";
|
6
6
|
export let selected = false;
|
7
7
|
</script>
|
@@ -11,7 +11,7 @@
|
|
11
11
|
class:gallery={type === "gallery"}
|
12
12
|
class:selected
|
13
13
|
>
|
14
|
-
{Array.isArray(value) ? value.join(", ") : value}
|
14
|
+
{value ? (Array.isArray(value) ? value.join(", ") : value) : ""}
|
15
15
|
</div>
|
16
16
|
|
17
17
|
<style>
|
@@ -0,0 +1,64 @@
|
|
1
|
+
<script context="module">
|
2
|
+
import { Template, Story } from "@storybook/addon-svelte-csf";
|
3
|
+
import { format } from "svelte-i18n";
|
4
|
+
import FileUpload from "./shared/FileUpload.svelte";
|
5
|
+
import { get } from "svelte/store";
|
6
|
+
|
7
|
+
export const meta = {
|
8
|
+
title: "Components/FileUpload",
|
9
|
+
component: FileUpload,
|
10
|
+
argTypes: {
|
11
|
+
value: {
|
12
|
+
control: "text",
|
13
|
+
description: "The URL or filepath (or list of URLs or filepaths)",
|
14
|
+
name: "value",
|
15
|
+
value: []
|
16
|
+
},
|
17
|
+
file_count: {
|
18
|
+
control: "radio",
|
19
|
+
options: ["single", "multiple"],
|
20
|
+
description: "Whether to allow single or multiple files to be uploaded",
|
21
|
+
name: "file_count",
|
22
|
+
value: "single"
|
23
|
+
}
|
24
|
+
}
|
25
|
+
};
|
26
|
+
</script>
|
27
|
+
|
28
|
+
<Template let:args>
|
29
|
+
<FileUpload {...args} i18n={get(format)} />
|
30
|
+
</Template>
|
31
|
+
|
32
|
+
<Story
|
33
|
+
name="Single File"
|
34
|
+
args={{
|
35
|
+
value: [
|
36
|
+
{
|
37
|
+
path: "cheetah.jpg",
|
38
|
+
orig_name: "cheetah.jpg",
|
39
|
+
url: "https://gradio-builds.s3.amazonaws.com/demo-files/ghepardo-primo-piano.jpg",
|
40
|
+
size: 10000
|
41
|
+
}
|
42
|
+
],
|
43
|
+
file_count: "single"
|
44
|
+
}}
|
45
|
+
/>
|
46
|
+
<Story
|
47
|
+
name="Multiple files"
|
48
|
+
args={{
|
49
|
+
value: Array(2).fill({
|
50
|
+
path: "cheetah.jpg",
|
51
|
+
orig_name: "cheetah.jpg",
|
52
|
+
url: "https://gradio-builds.s3.amazonaws.com/demo-files/ghepardo-primo-piano.jpg",
|
53
|
+
size: 10000
|
54
|
+
}),
|
55
|
+
file_count: "multiple"
|
56
|
+
}}
|
57
|
+
/>
|
58
|
+
<Story
|
59
|
+
name="No value"
|
60
|
+
args={{
|
61
|
+
value: null,
|
62
|
+
file_count: "multiple"
|
63
|
+
}}
|
64
|
+
/>
|
package/package.json
CHANGED
@@ -1,19 +1,19 @@
|
|
1
1
|
{
|
2
2
|
"name": "@gradio/file",
|
3
|
-
"version": "0.4.
|
3
|
+
"version": "0.4.9",
|
4
4
|
"description": "Gradio UI packages",
|
5
5
|
"type": "module",
|
6
6
|
"author": "",
|
7
7
|
"license": "ISC",
|
8
8
|
"private": false,
|
9
9
|
"dependencies": {
|
10
|
-
"@gradio/
|
11
|
-
"@gradio/
|
12
|
-
"@gradio/
|
10
|
+
"@gradio/client": "^0.11.0",
|
11
|
+
"@gradio/atoms": "^0.5.1",
|
12
|
+
"@gradio/statustracker": "^0.4.5",
|
13
13
|
"@gradio/icons": "^0.3.2",
|
14
|
-
"@gradio/
|
15
|
-
"@gradio/
|
16
|
-
"@gradio/
|
14
|
+
"@gradio/upload": "^0.7.1",
|
15
|
+
"@gradio/utils": "^0.2.2",
|
16
|
+
"@gradio/wasm": "^0.6.0"
|
17
17
|
},
|
18
18
|
"main": "./Index.svelte",
|
19
19
|
"main_changeset": true,
|
package/shared/FileUpload.svelte
CHANGED
@@ -67,7 +67,7 @@
|
|
67
67
|
label={label || "File"}
|
68
68
|
/>
|
69
69
|
|
70
|
-
{#if value && (Array.isArray(value) ? value.length > 0 :
|
70
|
+
{#if value && (Array.isArray(value) ? value.length > 0 : true)}
|
71
71
|
<ModifyUpload {i18n} on:clear={handle_clear} absolute />
|
72
72
|
<FilePreview {i18n} on:select {selectable} {value} {height} />
|
73
73
|
{:else}
|