@gradio/uploadbutton 0.9.13-dev.0 → 0.9.13-dev.1
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 +22 -0
- package/Index.svelte +29 -38
- package/dist/Index.svelte +43 -37
- package/dist/Index.svelte.d.ts +3 -38
- package/dist/shared/UploadButton.svelte +80 -66
- package/dist/shared/UploadButton.svelte.d.ts +47 -38
- package/dist/types.d.ts +15 -0
- package/dist/types.js +1 -0
- package/package.json +7 -7
- package/types.ts +17 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,27 @@
|
|
|
1
1
|
# @gradio/uploadbutton
|
|
2
2
|
|
|
3
|
+
## 0.9.13-dev.1
|
|
4
|
+
|
|
5
|
+
### Dependency updates
|
|
6
|
+
|
|
7
|
+
- @gradio/client@2.0.0-dev.2
|
|
8
|
+
- @gradio/button@0.5.14-dev.2
|
|
9
|
+
- @gradio/upload@0.17.2-dev.2
|
|
10
|
+
|
|
11
|
+
## 0.9.13-dev.1
|
|
12
|
+
|
|
13
|
+
### Dependency updates
|
|
14
|
+
|
|
15
|
+
- @gradio/upload@0.17.2-dev.1
|
|
16
|
+
- @gradio/utils@0.10.3-dev.0
|
|
17
|
+
- @gradio/button@0.5.14-dev.1
|
|
18
|
+
|
|
19
|
+
## 0.9.13-dev.0
|
|
20
|
+
|
|
21
|
+
### Dependency updates
|
|
22
|
+
|
|
23
|
+
- @gradio/client@2.0.0-dev.1
|
|
24
|
+
|
|
3
25
|
## 0.9.13-dev.0
|
|
4
26
|
|
|
5
27
|
### Dependency updates
|
package/Index.svelte
CHANGED
|
@@ -3,65 +3,56 @@
|
|
|
3
3
|
</script>
|
|
4
4
|
|
|
5
5
|
<script lang="ts">
|
|
6
|
-
import type {
|
|
6
|
+
import type { UploadButtonProps, UploadButtonEvents } from "./types";
|
|
7
7
|
import type { FileData } from "@gradio/client";
|
|
8
|
+
import { Gradio } from "@gradio/utils";
|
|
8
9
|
import UploadButton from "./shared/UploadButton.svelte";
|
|
9
10
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
export let visible: boolean | "hidden" = true;
|
|
13
|
-
export let label: string | null;
|
|
14
|
-
export let value: null | FileData | FileData[];
|
|
15
|
-
export let file_count: string;
|
|
16
|
-
export let file_types: string[] = [];
|
|
17
|
-
export let root: string;
|
|
18
|
-
export let size: "sm" | "lg" = "lg";
|
|
19
|
-
export let scale: number | null = null;
|
|
20
|
-
export let icon: FileData | null = null;
|
|
21
|
-
export let min_width: number | undefined = undefined;
|
|
22
|
-
export let variant: "primary" | "secondary" | "stop" = "secondary";
|
|
23
|
-
export let gradio: Gradio<{
|
|
24
|
-
change: never;
|
|
25
|
-
upload: never;
|
|
26
|
-
click: never;
|
|
27
|
-
error: string;
|
|
28
|
-
}>;
|
|
29
|
-
export let interactive: boolean;
|
|
11
|
+
const props = $props();
|
|
12
|
+
const gradio = new Gradio<UploadButtonEvents, UploadButtonProps>(props);
|
|
30
13
|
|
|
31
|
-
|
|
14
|
+
let value = $state(gradio.props.value);
|
|
15
|
+
|
|
16
|
+
$effect(() => {
|
|
17
|
+
if (value !== gradio.props.value) {
|
|
18
|
+
gradio.props.value = value;
|
|
19
|
+
}
|
|
20
|
+
});
|
|
32
21
|
|
|
33
22
|
async function handle_event(
|
|
34
23
|
detail: null | FileData | FileData[],
|
|
35
24
|
event: "change" | "upload" | "click"
|
|
36
25
|
): Promise<void> {
|
|
37
|
-
value = detail;
|
|
26
|
+
gradio.props.value = detail;
|
|
38
27
|
gradio.dispatch(event);
|
|
39
28
|
}
|
|
29
|
+
|
|
30
|
+
const disabled = $derived(!gradio.shared.interactive);
|
|
40
31
|
</script>
|
|
41
32
|
|
|
42
33
|
<UploadButton
|
|
43
|
-
{elem_id}
|
|
44
|
-
{elem_classes}
|
|
45
|
-
{visible}
|
|
46
|
-
{file_count}
|
|
47
|
-
{file_types}
|
|
48
|
-
{size}
|
|
49
|
-
{scale}
|
|
50
|
-
{icon}
|
|
51
|
-
{min_width}
|
|
52
|
-
{root}
|
|
34
|
+
elem_id={gradio.shared.elem_id}
|
|
35
|
+
elem_classes={gradio.shared.elem_classes}
|
|
36
|
+
visible={gradio.shared.visible}
|
|
37
|
+
file_count={gradio.props.file_count}
|
|
38
|
+
file_types={gradio.props.file_types}
|
|
39
|
+
size={gradio.props.size}
|
|
40
|
+
scale={gradio.shared.scale}
|
|
41
|
+
icon={gradio.props.icon}
|
|
42
|
+
min_width={gradio.shared.min_width}
|
|
43
|
+
root={gradio.shared.root}
|
|
53
44
|
{value}
|
|
54
45
|
{disabled}
|
|
55
|
-
{variant}
|
|
56
|
-
{label}
|
|
57
|
-
max_file_size={gradio.max_file_size}
|
|
46
|
+
variant={gradio.props.variant}
|
|
47
|
+
label={gradio.shared.label}
|
|
48
|
+
max_file_size={gradio.shared.max_file_size}
|
|
58
49
|
on:click={() => gradio.dispatch("click")}
|
|
59
50
|
on:change={({ detail }) => handle_event(detail, "change")}
|
|
60
51
|
on:upload={({ detail }) => handle_event(detail, "upload")}
|
|
61
52
|
on:error={({ detail }) => {
|
|
62
53
|
gradio.dispatch("error", detail);
|
|
63
54
|
}}
|
|
64
|
-
upload={(...args) => gradio.client.upload(...args)}
|
|
55
|
+
upload={(...args) => gradio.shared.client.upload(...args)}
|
|
65
56
|
>
|
|
66
|
-
{label ?? ""}
|
|
57
|
+
{gradio.shared.label ?? ""}
|
|
67
58
|
</UploadButton>
|
package/dist/Index.svelte
CHANGED
|
@@ -1,52 +1,58 @@
|
|
|
1
|
-
<script context="module">
|
|
1
|
+
<script lang="ts" context="module">
|
|
2
|
+
export { default as BaseUploadButton } from "./shared/UploadButton.svelte";
|
|
2
3
|
</script>
|
|
3
4
|
|
|
4
|
-
<script
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
async function handle_event(
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
5
|
+
<script lang="ts">
|
|
6
|
+
import type { UploadButtonProps, UploadButtonEvents } from "./types";
|
|
7
|
+
import type { FileData } from "@gradio/client";
|
|
8
|
+
import { Gradio } from "@gradio/utils";
|
|
9
|
+
import UploadButton from "./shared/UploadButton.svelte";
|
|
10
|
+
|
|
11
|
+
const props = $props();
|
|
12
|
+
const gradio = new Gradio<UploadButtonEvents, UploadButtonProps>(props);
|
|
13
|
+
|
|
14
|
+
let value = $state(gradio.props.value);
|
|
15
|
+
|
|
16
|
+
$effect(() => {
|
|
17
|
+
if (value !== gradio.props.value) {
|
|
18
|
+
gradio.props.value = value;
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
async function handle_event(
|
|
23
|
+
detail: null | FileData | FileData[],
|
|
24
|
+
event: "change" | "upload" | "click"
|
|
25
|
+
): Promise<void> {
|
|
26
|
+
gradio.props.value = detail;
|
|
27
|
+
gradio.dispatch(event);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const disabled = $derived(!gradio.shared.interactive);
|
|
25
31
|
</script>
|
|
26
32
|
|
|
27
33
|
<UploadButton
|
|
28
|
-
{elem_id}
|
|
29
|
-
{elem_classes}
|
|
30
|
-
{visible}
|
|
31
|
-
{file_count}
|
|
32
|
-
{file_types}
|
|
33
|
-
{size}
|
|
34
|
-
{scale}
|
|
35
|
-
{icon}
|
|
36
|
-
{min_width}
|
|
37
|
-
{root}
|
|
34
|
+
elem_id={gradio.shared.elem_id}
|
|
35
|
+
elem_classes={gradio.shared.elem_classes}
|
|
36
|
+
visible={gradio.shared.visible}
|
|
37
|
+
file_count={gradio.props.file_count}
|
|
38
|
+
file_types={gradio.props.file_types}
|
|
39
|
+
size={gradio.props.size}
|
|
40
|
+
scale={gradio.shared.scale}
|
|
41
|
+
icon={gradio.props.icon}
|
|
42
|
+
min_width={gradio.shared.min_width}
|
|
43
|
+
root={gradio.shared.root}
|
|
38
44
|
{value}
|
|
39
45
|
{disabled}
|
|
40
|
-
{variant}
|
|
41
|
-
{label}
|
|
42
|
-
max_file_size={gradio.max_file_size}
|
|
46
|
+
variant={gradio.props.variant}
|
|
47
|
+
label={gradio.shared.label}
|
|
48
|
+
max_file_size={gradio.shared.max_file_size}
|
|
43
49
|
on:click={() => gradio.dispatch("click")}
|
|
44
50
|
on:change={({ detail }) => handle_event(detail, "change")}
|
|
45
51
|
on:upload={({ detail }) => handle_event(detail, "upload")}
|
|
46
52
|
on:error={({ detail }) => {
|
|
47
53
|
gradio.dispatch("error", detail);
|
|
48
54
|
}}
|
|
49
|
-
upload={(...args) => gradio.client.upload(...args)}
|
|
55
|
+
upload={(...args) => gradio.shared.client.upload(...args)}
|
|
50
56
|
>
|
|
51
|
-
{label ?? ""}
|
|
57
|
+
{gradio.shared.label ?? ""}
|
|
52
58
|
</UploadButton>
|
package/dist/Index.svelte.d.ts
CHANGED
|
@@ -1,39 +1,4 @@
|
|
|
1
|
-
import { SvelteComponent } from "svelte";
|
|
2
1
|
export { default as BaseUploadButton } from "./shared/UploadButton.svelte";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
props: {
|
|
7
|
-
elem_id?: string;
|
|
8
|
-
elem_classes?: string[];
|
|
9
|
-
visible?: boolean | "hidden";
|
|
10
|
-
label: string | null;
|
|
11
|
-
value: null | FileData | FileData[];
|
|
12
|
-
file_count: string;
|
|
13
|
-
file_types?: string[];
|
|
14
|
-
root: string;
|
|
15
|
-
size?: "sm" | "lg";
|
|
16
|
-
scale?: number | null;
|
|
17
|
-
icon?: FileData | null;
|
|
18
|
-
min_width?: number | undefined;
|
|
19
|
-
variant?: "primary" | "secondary" | "stop";
|
|
20
|
-
gradio: Gradio<{
|
|
21
|
-
change: never;
|
|
22
|
-
upload: never;
|
|
23
|
-
click: never;
|
|
24
|
-
error: string;
|
|
25
|
-
}>;
|
|
26
|
-
interactive: boolean;
|
|
27
|
-
};
|
|
28
|
-
events: {
|
|
29
|
-
[evt: string]: CustomEvent<any>;
|
|
30
|
-
};
|
|
31
|
-
slots: {};
|
|
32
|
-
exports?: {} | undefined;
|
|
33
|
-
bindings?: string | undefined;
|
|
34
|
-
};
|
|
35
|
-
export type IndexProps = typeof __propDef.props;
|
|
36
|
-
export type IndexEvents = typeof __propDef.events;
|
|
37
|
-
export type IndexSlots = typeof __propDef.slots;
|
|
38
|
-
export default class Index extends SvelteComponent<IndexProps, IndexEvents, IndexSlots> {
|
|
39
|
-
}
|
|
2
|
+
declare const Index: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
3
|
+
type Index = ReturnType<typeof Index>;
|
|
4
|
+
export default Index;
|
|
@@ -1,69 +1,83 @@
|
|
|
1
|
-
<script
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
export let
|
|
7
|
-
export let
|
|
8
|
-
export let
|
|
9
|
-
export let
|
|
10
|
-
export let
|
|
11
|
-
export let
|
|
12
|
-
export let
|
|
13
|
-
export let
|
|
14
|
-
export let
|
|
15
|
-
export let
|
|
16
|
-
export let
|
|
17
|
-
export let
|
|
18
|
-
export let
|
|
19
|
-
export let
|
|
20
|
-
|
|
21
|
-
let
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { tick, createEventDispatcher } from "svelte";
|
|
3
|
+
import { BaseButton } from "@gradio/button";
|
|
4
|
+
import { prepare_files, type FileData, type Client } from "@gradio/client";
|
|
5
|
+
|
|
6
|
+
export let elem_id = "";
|
|
7
|
+
export let elem_classes: string[] = [];
|
|
8
|
+
export let visible: boolean | "hidden" = true;
|
|
9
|
+
export let label: string | null;
|
|
10
|
+
export let value: null | FileData | FileData[];
|
|
11
|
+
export let file_count: string;
|
|
12
|
+
export let file_types: string[] = [];
|
|
13
|
+
export let root: string;
|
|
14
|
+
export let size: "sm" | "md" | "lg" = "lg";
|
|
15
|
+
export let icon: FileData | null = null;
|
|
16
|
+
export let scale: number | null = null;
|
|
17
|
+
export let min_width: number | undefined = undefined;
|
|
18
|
+
export let variant: "primary" | "secondary" | "stop" = "secondary";
|
|
19
|
+
export let disabled = false;
|
|
20
|
+
export let max_file_size: number | null = null;
|
|
21
|
+
export let upload: Client["upload"];
|
|
22
|
+
|
|
23
|
+
const dispatch = createEventDispatcher();
|
|
24
|
+
|
|
25
|
+
let hidden_upload: HTMLInputElement;
|
|
26
|
+
let accept_file_types: string | null;
|
|
27
|
+
|
|
28
|
+
if (file_types == null) {
|
|
29
|
+
accept_file_types = null;
|
|
30
|
+
} else {
|
|
31
|
+
file_types = file_types.map((x) => {
|
|
32
|
+
if (x.startsWith(".")) {
|
|
33
|
+
return x;
|
|
34
|
+
}
|
|
35
|
+
return x + "/*";
|
|
36
|
+
});
|
|
37
|
+
accept_file_types = file_types.join(", ");
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
function open_file_upload(): void {
|
|
41
|
+
dispatch("click");
|
|
42
|
+
hidden_upload.click();
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
async function load_files(files: FileList): Promise<void> {
|
|
46
|
+
let _files: File[] = Array.from(files);
|
|
47
|
+
|
|
48
|
+
if (!files.length) {
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
if (file_count === "single") {
|
|
52
|
+
_files = [files[0]];
|
|
53
|
+
}
|
|
54
|
+
let all_file_data = await prepare_files(_files);
|
|
55
|
+
await tick();
|
|
56
|
+
|
|
57
|
+
try {
|
|
58
|
+
all_file_data = (
|
|
59
|
+
await upload(all_file_data, root, undefined, max_file_size ?? Infinity)
|
|
60
|
+
)?.filter((x) => x !== null) as FileData[];
|
|
61
|
+
} catch (e) {
|
|
62
|
+
dispatch("error", (e as Error).message);
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
value = file_count === "single" ? all_file_data?.[0] : all_file_data;
|
|
66
|
+
dispatch("change", value);
|
|
67
|
+
dispatch("upload", value);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
async function load_files_from_upload(e: Event): Promise<void> {
|
|
71
|
+
const target = e.target as HTMLInputElement;
|
|
72
|
+
|
|
73
|
+
if (!target.files) return;
|
|
74
|
+
await load_files(target.files);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
function clear_input_value(e: Event): void {
|
|
78
|
+
const target = e.target as HTMLInputElement;
|
|
79
|
+
if (target.value) target.value = "";
|
|
80
|
+
}
|
|
67
81
|
</script>
|
|
68
82
|
|
|
69
83
|
<input
|
|
@@ -1,41 +1,50 @@
|
|
|
1
|
-
import { SvelteComponent } from "svelte";
|
|
2
1
|
import { type FileData, type Client } from "@gradio/client";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
size?: "sm" | "md" | "lg";
|
|
14
|
-
icon?: FileData | null;
|
|
15
|
-
scale?: number | null;
|
|
16
|
-
min_width?: number | undefined;
|
|
17
|
-
variant?: "primary" | "secondary" | "stop";
|
|
18
|
-
disabled?: boolean;
|
|
19
|
-
max_file_size?: number | null;
|
|
20
|
-
upload: Client["upload"];
|
|
2
|
+
interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
|
|
3
|
+
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
|
4
|
+
$$bindings?: Bindings;
|
|
5
|
+
} & Exports;
|
|
6
|
+
(internal: unknown, props: Props & {
|
|
7
|
+
$$events?: Events;
|
|
8
|
+
$$slots?: Slots;
|
|
9
|
+
}): Exports & {
|
|
10
|
+
$set?: any;
|
|
11
|
+
$on?: any;
|
|
21
12
|
};
|
|
22
|
-
|
|
23
|
-
click: CustomEvent<any>;
|
|
24
|
-
error: CustomEvent<any>;
|
|
25
|
-
change: CustomEvent<any>;
|
|
26
|
-
upload: CustomEvent<any>;
|
|
27
|
-
} & {
|
|
28
|
-
[evt: string]: CustomEvent<any>;
|
|
29
|
-
};
|
|
30
|
-
slots: {
|
|
31
|
-
default: {};
|
|
32
|
-
};
|
|
33
|
-
exports?: {} | undefined;
|
|
34
|
-
bindings?: string | undefined;
|
|
35
|
-
};
|
|
36
|
-
export type UploadButtonProps = typeof __propDef.props;
|
|
37
|
-
export type UploadButtonEvents = typeof __propDef.events;
|
|
38
|
-
export type UploadButtonSlots = typeof __propDef.slots;
|
|
39
|
-
export default class UploadButton extends SvelteComponent<UploadButtonProps, UploadButtonEvents, UploadButtonSlots> {
|
|
13
|
+
z_$$bindings?: Bindings;
|
|
40
14
|
}
|
|
41
|
-
|
|
15
|
+
type $$__sveltets_2_PropsWithChildren<Props, Slots> = Props & (Slots extends {
|
|
16
|
+
default: any;
|
|
17
|
+
} ? Props extends Record<string, never> ? any : {
|
|
18
|
+
children?: any;
|
|
19
|
+
} : {});
|
|
20
|
+
declare const UploadButton: $$__sveltets_2_IsomorphicComponent<$$__sveltets_2_PropsWithChildren<{
|
|
21
|
+
elem_id?: string;
|
|
22
|
+
elem_classes?: string[];
|
|
23
|
+
visible?: boolean | "hidden";
|
|
24
|
+
label: string | null;
|
|
25
|
+
value: null | FileData | FileData[];
|
|
26
|
+
file_count: string;
|
|
27
|
+
file_types?: string[];
|
|
28
|
+
root: string;
|
|
29
|
+
size?: "sm" | "md" | "lg";
|
|
30
|
+
icon?: FileData | null;
|
|
31
|
+
scale?: number | null;
|
|
32
|
+
min_width?: number | undefined;
|
|
33
|
+
variant?: "primary" | "secondary" | "stop";
|
|
34
|
+
disabled?: boolean;
|
|
35
|
+
max_file_size?: number | null;
|
|
36
|
+
upload: Client["upload"];
|
|
37
|
+
}, {
|
|
38
|
+
default: {};
|
|
39
|
+
}>, {
|
|
40
|
+
click: CustomEvent<any>;
|
|
41
|
+
error: CustomEvent<any>;
|
|
42
|
+
change: CustomEvent<any>;
|
|
43
|
+
upload: CustomEvent<any>;
|
|
44
|
+
} & {
|
|
45
|
+
[evt: string]: CustomEvent<any>;
|
|
46
|
+
}, {
|
|
47
|
+
default: {};
|
|
48
|
+
}, {}, string>;
|
|
49
|
+
type UploadButton = InstanceType<typeof UploadButton>;
|
|
50
|
+
export default UploadButton;
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { FileData } from "@gradio/client";
|
|
2
|
+
export interface UploadButtonProps {
|
|
3
|
+
value: null | FileData | FileData[];
|
|
4
|
+
file_count: string;
|
|
5
|
+
file_types: string[];
|
|
6
|
+
size: "sm" | "lg";
|
|
7
|
+
icon: FileData | null;
|
|
8
|
+
variant: "primary" | "secondary" | "stop";
|
|
9
|
+
}
|
|
10
|
+
export interface UploadButtonEvents {
|
|
11
|
+
change: never;
|
|
12
|
+
upload: never;
|
|
13
|
+
click: never;
|
|
14
|
+
error: string;
|
|
15
|
+
}
|
package/dist/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gradio/uploadbutton",
|
|
3
|
-
"version": "0.9.13-dev.
|
|
3
|
+
"version": "0.9.13-dev.1",
|
|
4
4
|
"description": "Gradio UI packages",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"author": "",
|
|
@@ -17,16 +17,16 @@
|
|
|
17
17
|
},
|
|
18
18
|
"main": "./Index.svelte",
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@gradio/client": "^2.0.0-dev.
|
|
21
|
-
"@gradio/upload": "^0.17.2-dev.
|
|
22
|
-
"@gradio/
|
|
23
|
-
"@gradio/
|
|
20
|
+
"@gradio/client": "^2.0.0-dev.2",
|
|
21
|
+
"@gradio/upload": "^0.17.2-dev.2",
|
|
22
|
+
"@gradio/button": "^0.5.14-dev.2",
|
|
23
|
+
"@gradio/utils": "^0.10.3-dev.0"
|
|
24
24
|
},
|
|
25
25
|
"devDependencies": {
|
|
26
|
-
"@gradio/preview": "^0.
|
|
26
|
+
"@gradio/preview": "^0.15.0-dev.0"
|
|
27
27
|
},
|
|
28
28
|
"peerDependencies": {
|
|
29
|
-
"svelte": "^
|
|
29
|
+
"svelte": "^5.43.4"
|
|
30
30
|
},
|
|
31
31
|
"repository": {
|
|
32
32
|
"type": "git",
|
package/types.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { FileData } from "@gradio/client";
|
|
2
|
+
|
|
3
|
+
export interface UploadButtonProps {
|
|
4
|
+
value: null | FileData | FileData[];
|
|
5
|
+
file_count: string;
|
|
6
|
+
file_types: string[];
|
|
7
|
+
size: "sm" | "lg";
|
|
8
|
+
icon: FileData | null;
|
|
9
|
+
variant: "primary" | "secondary" | "stop";
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export interface UploadButtonEvents {
|
|
13
|
+
change: never;
|
|
14
|
+
upload: never;
|
|
15
|
+
click: never;
|
|
16
|
+
error: string;
|
|
17
|
+
}
|