gradio-pr-bot commited on
Commit
7c5bf2a
·
verified ·
1 Parent(s): 926810c

Upload folder using huggingface_hub

Browse files
6.2.1/fileexplorer/Example.svelte ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <script lang="ts">
2
+ export let value: string[] | string | null;
3
+ export let type: "gallery" | "table";
4
+ export let selected = false;
5
+ </script>
6
+
7
+ <ul
8
+ class:table={type === "table"}
9
+ class:gallery={type === "gallery"}
10
+ class:selected
11
+ >
12
+ {#if value}
13
+ {#each Array.isArray(value) ? value.slice(0, 3) : [value] as path}
14
+ <li><code>./{path}</code></li>
15
+ {/each}
16
+ {#if Array.isArray(value) && value.length > 3}
17
+ <li class="extra">...</li>
18
+ {/if}
19
+ {/if}
20
+ </ul>
21
+
22
+ <style>
23
+ ul {
24
+ white-space: nowrap;
25
+ max-height: 100px;
26
+ list-style: none;
27
+ padding: 0;
28
+ margin: 0;
29
+ }
30
+
31
+ .extra {
32
+ text-align: center;
33
+ }
34
+
35
+ .gallery {
36
+ align-items: center;
37
+ cursor: pointer;
38
+ padding: var(--size-1) var(--size-2);
39
+ text-align: left;
40
+ }
41
+ </style>
6.2.1/fileexplorer/Index.svelte ADDED
@@ -0,0 +1,82 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <svelte:options accessors={true} />
2
+
3
+ <script lang="ts">
4
+ import type { FileExplorerProps, FileExplorerEvents } from "./types";
5
+ import { Gradio } from "@gradio/utils";
6
+ import { File } from "@gradio/icons";
7
+
8
+ import { Block, BlockLabel, IconButtonWrapper } from "@gradio/atoms";
9
+ import DirectoryExplorer from "./shared/DirectoryExplorer.svelte";
10
+
11
+ import { StatusTracker } from "@gradio/statustracker";
12
+
13
+ import { _ } from "svelte-i18n";
14
+
15
+ const props = $props();
16
+ const gradio = new Gradio<FileExplorerEvents, FileExplorerProps>(props);
17
+
18
+ let old_value = $state(gradio.props.value);
19
+
20
+ let rerender_key = $derived([
21
+ gradio.props.root_dir,
22
+ gradio.props.glob,
23
+ gradio.props.ignore_glob
24
+ ]);
25
+
26
+ $effect(() => {
27
+ if (old_value != gradio.props.value) {
28
+ old_value = gradio.props.value;
29
+ gradio.dispatch("change");
30
+ }
31
+ });
32
+ </script>
33
+
34
+ <Block
35
+ visible={gradio.shared.visible}
36
+ variant={gradio.props.value === null ? "dashed" : "solid"}
37
+ border_mode={"base"}
38
+ padding={false}
39
+ elem_id={gradio.shared.elem_id}
40
+ elem_classes={gradio.shared.elem_classes}
41
+ container={gradio.shared.container}
42
+ scale={gradio.shared.scale}
43
+ min_width={gradio.shared.min_width}
44
+ allow_overflow={true}
45
+ overflow_behavior="auto"
46
+ height={gradio.props.height}
47
+ max_height={gradio.props.max_height}
48
+ min_height={gradio.props.min_height}
49
+ >
50
+ <StatusTracker
51
+ {...gradio.shared.loading_status}
52
+ autoscroll={gradio.shared.autoscroll}
53
+ i18n={gradio.i18n}
54
+ on_clear_status={() =>
55
+ gradio.dispatch("clear_status", gradio.shared.loading_status)}
56
+ />
57
+ {#if gradio.shared.show_label && gradio.props.buttons && gradio.props.buttons.length > 0}
58
+ <IconButtonWrapper
59
+ buttons={gradio.props.buttons}
60
+ on_custom_button_click={(id) => {
61
+ gradio.dispatch("custom_button_click", { id });
62
+ }}
63
+ />
64
+ {/if}
65
+ <BlockLabel
66
+ show_label={gradio.shared.show_label}
67
+ Icon={File}
68
+ label={gradio.shared.label || "FileExplorer"}
69
+ float={false}
70
+ />
71
+ {#key rerender_key}
72
+ <DirectoryExplorer
73
+ bind:value={gradio.props.value}
74
+ file_count={gradio.props.file_count}
75
+ interactive={gradio.shared.interactive}
76
+ selectable={gradio.props._selectable}
77
+ ls_fn={gradio.shared.server.ls}
78
+ on:input={() => gradio.dispatch("input")}
79
+ on:select={(e) => gradio.dispatch("select", e.detail)}
80
+ />
81
+ {/key}
82
+ </Block>
6.2.1/fileexplorer/package.json ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "name": "@gradio/fileexplorer",
3
+ "version": "0.6.0",
4
+ "description": "Gradio UI packages",
5
+ "type": "module",
6
+ "author": "",
7
+ "license": "ISC",
8
+ "dependencies": {
9
+ "@gradio/atoms": "workspace:^",
10
+ "@gradio/checkbox": "workspace:^",
11
+ "@gradio/client": "workspace:^",
12
+ "@gradio/file": "workspace:^",
13
+ "@gradio/icons": "workspace:^",
14
+ "@gradio/statustracker": "workspace:^",
15
+ "@gradio/upload": "workspace:^",
16
+ "@gradio/utils": "workspace:^",
17
+ "dequal": "^2.0.3"
18
+ },
19
+ "devDependencies": {
20
+ "@gradio/preview": "workspace:^"
21
+ },
22
+ "main_changeset": true,
23
+ "exports": {
24
+ ".": {
25
+ "gradio": "./Index.svelte",
26
+ "svelte": "./dist/Index.svelte",
27
+ "types": "./dist/Index.svelte.d.ts"
28
+ },
29
+ "./example": {
30
+ "gradio": "./Example.svelte",
31
+ "svelte": "./dist/Example.svelte",
32
+ "types": "./dist/Example.svelte.d.ts"
33
+ },
34
+ "./package.json": "./package.json"
35
+ },
36
+ "peerDependencies": {
37
+ "svelte": "^5.43.4"
38
+ },
39
+ "repository": {
40
+ "type": "git",
41
+ "url": "git+https://github.com/gradio-app/gradio.git",
42
+ "directory": "js/fileexplorer"
43
+ }
44
+ }
6.2.1/fileexplorer/shared/ArrowIcon.svelte ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <svg
2
+ width="100%"
3
+ height="100%"
4
+ viewBox="0 0 14 17"
5
+ version="1.1"
6
+ style="fill-rule:evenodd;clip-rule:evenodd;stroke-linejoin:round;stroke-miterlimit:2;"
7
+ >
8
+ <g transform="matrix(1,0,0,1,-10.6667,-7.73588)">
9
+ <path
10
+ d="M12.7,24.033C12.256,24.322 11.806,24.339 11.351,24.084C10.896,23.829 10.668,23.434 10.667,22.9L10.667,9.1C10.667,8.567 10.895,8.172 11.351,7.916C11.807,7.66 12.256,7.677 12.7,7.967L23.567,14.867C23.967,15.133 24.167,15.511 24.167,16C24.167,16.489 23.967,16.867 23.567,17.133L12.7,24.033Z"
11
+ style="fill:currentColor;fill-rule:nonzero;"
12
+ />
13
+ </g>
14
+ </svg>
6.2.1/fileexplorer/shared/Checkbox.svelte ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <script lang="ts">
2
+ import { createEventDispatcher } from "svelte";
3
+ export let value: boolean;
4
+ export let disabled: boolean;
5
+ const dispatch = createEventDispatcher<{ change: boolean }>();
6
+ </script>
7
+
8
+ <input
9
+ bind:checked={value}
10
+ on:input={() => dispatch("change", !value)}
11
+ type="checkbox"
12
+ {disabled}
13
+ class:disabled={disabled && !value}
14
+ />
15
+
16
+ <style>
17
+ input {
18
+ --ring-color: transparent;
19
+ position: relative;
20
+ box-shadow: var(--input-shadow);
21
+ border: 1px solid var(--checkbox-border-color);
22
+ border-radius: var(--radius-xs);
23
+ background-color: var(--checkbox-background-color);
24
+ line-height: var(--line-sm);
25
+ width: 18px !important;
26
+ height: 18px !important;
27
+ }
28
+
29
+ input:checked,
30
+ input:checked:hover,
31
+ input:checked:focus {
32
+ border-color: var(--checkbox-border-color-selected);
33
+ background-image: var(--checkbox-check);
34
+ background-color: var(--checkbox-background-color-selected);
35
+ }
36
+
37
+ input:hover {
38
+ border-color: var(--checkbox-border-color-hover);
39
+ background-color: var(--checkbox-background-color-hover);
40
+ }
41
+
42
+ input:focus {
43
+ border-color: var(--checkbox-border-color-focus);
44
+ background-color: var(--checkbox-background-color-focus);
45
+ }
46
+
47
+ .disabled {
48
+ opacity: 0.8 !important;
49
+ cursor: not-allowed;
50
+ }
51
+ </style>
6.2.1/fileexplorer/shared/DirectoryExplorer.svelte ADDED
@@ -0,0 +1,80 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <script lang="ts">
2
+ import FileTree from "./FileTree.svelte";
3
+ import type { FileNode } from "./types";
4
+ import type { SelectData } from "@gradio/utils";
5
+ import { createEventDispatcher } from "svelte";
6
+
7
+ export let interactive: boolean;
8
+ export let file_count: "single" | "multiple" = "multiple";
9
+ export let value: string[][] = [];
10
+ export let selectable: boolean = false;
11
+ export let ls_fn: (path: string[]) => Promise<FileNode[]>;
12
+ let selected_folders: string[][] = [];
13
+
14
+ const dispatch = createEventDispatcher<{
15
+ select: SelectData;
16
+ input: void;
17
+ }>();
18
+
19
+ const paths_equal = (path: string[], path_2: string[]): boolean => {
20
+ return path.join("/") === path_2.join("/");
21
+ };
22
+
23
+ const path_in_set = (path: string[], set: string[][]): boolean => {
24
+ return set.some((x) => paths_equal(x, path));
25
+ };
26
+
27
+ const path_inside = (path: string[], path_2: string[]): boolean => {
28
+ return path.join("/").startsWith(path_2.join("/"));
29
+ };
30
+ </script>
31
+
32
+ <div class="file-wrap">
33
+ <FileTree
34
+ path={[]}
35
+ selected_files={value}
36
+ {selected_folders}
37
+ {interactive}
38
+ {selectable}
39
+ {ls_fn}
40
+ {file_count}
41
+ valid_for_selection={false}
42
+ on:check={(e) => {
43
+ const { path, checked, type } = e.detail;
44
+ if (checked) {
45
+ if (file_count === "single") {
46
+ value = [path];
47
+ } else if (type === "folder") {
48
+ if (!path_in_set(path, selected_folders)) {
49
+ selected_folders = [...selected_folders, path];
50
+ }
51
+ } else {
52
+ if (!path_in_set(path, value)) {
53
+ value = [...value, path];
54
+ }
55
+ }
56
+ } else {
57
+ selected_folders = selected_folders.filter(
58
+ (folder) => !path_inside(path, folder)
59
+ ); // deselect all parent folders
60
+ if (type === "folder") {
61
+ selected_folders = selected_folders.filter(
62
+ (folder) => !path_inside(folder, path)
63
+ ); // deselect all children folders
64
+ value = value.filter((file) => !path_inside(file, path)); // deselect all children files
65
+ } else {
66
+ value = value.filter((x) => !paths_equal(x, path));
67
+ }
68
+ }
69
+ dispatch("input");
70
+ }}
71
+ on:select={(e) => dispatch("select", e.detail)}
72
+ />
73
+ </div>
74
+
75
+ <style>
76
+ .file-wrap {
77
+ height: calc(100% - 25px);
78
+ overflow-y: scroll;
79
+ }
80
+ </style>
6.2.1/fileexplorer/shared/FileTree.svelte ADDED
@@ -0,0 +1,297 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <script lang="ts">
2
+ import type { FileNode } from "./types";
3
+ import type { SelectData } from "@gradio/utils";
4
+ import { createEventDispatcher } from "svelte";
5
+
6
+ import Arrow from "./ArrowIcon.svelte";
7
+ import Checkbox from "./Checkbox.svelte";
8
+ import FileIcon from "../icons/light-file.svg";
9
+ import FolderIcon from "../icons/light-folder.svg";
10
+
11
+ export let path: string[] = [];
12
+ export let index_path: number[] = [];
13
+ export let selected_files: string[][] = [];
14
+ export let selected_folders: string[][] = [];
15
+ export let is_selected_entirely = false;
16
+ export let interactive: boolean;
17
+ export let selectable: boolean = false;
18
+ export let ls_fn: (path: string[]) => Promise<FileNode[]>;
19
+ export let file_count: "single" | "multiple" = "multiple";
20
+ export let valid_for_selection: boolean;
21
+
22
+ let content: FileNode[] = [];
23
+ let opened_folders: number[] = [];
24
+
25
+ const toggle_open_folder = (i: number): void => {
26
+ if (opened_folders.includes(i)) {
27
+ opened_folders = opened_folders.filter((x) => x !== i);
28
+ } else {
29
+ opened_folders = [...opened_folders, i];
30
+ }
31
+ };
32
+
33
+ const open_folder = (i: number): void => {
34
+ if (!opened_folders.includes(i)) {
35
+ opened_folders = [...opened_folders, i];
36
+ }
37
+ };
38
+
39
+ (async () => {
40
+ content = await ls_fn(path);
41
+ if (valid_for_selection) {
42
+ content = [{ name: ".", type: "file" }, ...content];
43
+ }
44
+ opened_folders = content
45
+ .map((x, i) =>
46
+ x.type === "folder" &&
47
+ (is_selected_entirely || selected_files.some((y) => y[0] === x.name))
48
+ ? i
49
+ : null
50
+ )
51
+ .filter((x): x is number => x !== null);
52
+ })();
53
+
54
+ $: if (is_selected_entirely) {
55
+ content.forEach((x) => {
56
+ dispatch("check", {
57
+ path: [...path, x.name],
58
+ checked: true,
59
+ type: x.type
60
+ });
61
+ });
62
+ }
63
+
64
+ const dispatch = createEventDispatcher<{
65
+ check: { path: string[]; checked: boolean; type: "file" | "folder" };
66
+ select: SelectData;
67
+ }>();
68
+
69
+ function handle_select(
70
+ full_index_path: number[],
71
+ item_path: string[],
72
+ type: "file" | "folder"
73
+ ): void {
74
+ dispatch("select", {
75
+ index: full_index_path as any,
76
+ value: item_path.join("/"),
77
+ selected: true
78
+ });
79
+ }
80
+ </script>
81
+
82
+ <ul class:no-checkboxes={!interactive} class:root={path.length === 0}>
83
+ {#each content as { type, name, valid }, i}
84
+ {@const is_selected = (
85
+ type === "file" ? selected_files : selected_folders
86
+ ).some((x) => x[0] === name && x.length === 1)}
87
+ <li>
88
+ <span
89
+ class="wrap"
90
+ class:selected={!interactive && is_selected}
91
+ class:selectable
92
+ role={selectable ? "button" : undefined}
93
+ tabindex={selectable ? 0 : undefined}
94
+ on:click|stopPropagation={() => {
95
+ if (selectable) {
96
+ handle_select([...index_path, i], [...path, name], type);
97
+ }
98
+ }}
99
+ on:keydown={({ key }) => {
100
+ if (selectable && (key === " " || key === "Enter")) {
101
+ handle_select([...index_path, i], [...path, name], type);
102
+ }
103
+ }}
104
+ >
105
+ {#if interactive}
106
+ {#if type === "folder" && file_count === "single"}
107
+ <span class="no-checkbox" aria-hidden="true"></span>
108
+ {:else}
109
+ <Checkbox
110
+ disabled={false}
111
+ value={is_selected}
112
+ on:change={(e) => {
113
+ let checked = e.detail;
114
+ dispatch("check", {
115
+ path: [...path, name],
116
+ checked,
117
+ type
118
+ });
119
+ if (selectable) {
120
+ handle_select([...index_path, i], [...path, name], type);
121
+ }
122
+ if (type === "folder" && checked) {
123
+ open_folder(i);
124
+ }
125
+ }}
126
+ />
127
+ {/if}
128
+ {/if}
129
+
130
+ {#if type === "folder"}
131
+ <span
132
+ class="icon"
133
+ class:hidden={!opened_folders.includes(i)}
134
+ on:click|stopPropagation={() => toggle_open_folder(i)}
135
+ role="button"
136
+ aria-label="expand directory"
137
+ tabindex="0"
138
+ on:keydown={({ key }) => {
139
+ if (key === " " || key === "Enter") {
140
+ toggle_open_folder(i);
141
+ }
142
+ }}><Arrow /></span
143
+ >
144
+ {:else}
145
+ <span class="file-icon">
146
+ <img src={name === "." ? FolderIcon : FileIcon} alt="file icon" />
147
+ </span>
148
+ {/if}
149
+ <span class="item-name">{name}</span>
150
+ </span>
151
+ {#if type === "folder" && opened_folders.includes(i)}
152
+ <svelte:self
153
+ path={[...path, name]}
154
+ index_path={[...index_path, i]}
155
+ selected_files={selected_files
156
+ .filter((x) => x[0] === name)
157
+ .map((x) => x.slice(1))}
158
+ selected_folders={selected_folders
159
+ .filter((x) => x[0] === name)
160
+ .map((x) => x.slice(1))}
161
+ is_selected_entirely={selected_folders.some(
162
+ (x) => x[0] === name && x.length === 1
163
+ )}
164
+ {interactive}
165
+ {selectable}
166
+ {ls_fn}
167
+ {file_count}
168
+ valid_for_selection={valid}
169
+ on:check
170
+ on:select
171
+ />
172
+ {/if}
173
+ </li>
174
+ {/each}
175
+ </ul>
176
+
177
+ <style>
178
+ .icon {
179
+ display: inline-block;
180
+ width: 18px;
181
+ height: 18px;
182
+ padding: 3px 2px 3px 3px;
183
+ margin: 0;
184
+ flex-grow: 0;
185
+ display: inline-flex;
186
+ justify-content: center;
187
+ align-items: center;
188
+ border-radius: 2px;
189
+ cursor: pointer;
190
+ transition: 0.1s;
191
+ flex-shrink: 0;
192
+ }
193
+
194
+ .file-icon {
195
+ display: inline-block;
196
+ height: 20px;
197
+ margin-left: -1px;
198
+ margin: 0;
199
+ flex-grow: 0;
200
+ display: inline-flex;
201
+ justify-content: center;
202
+ align-items: center;
203
+
204
+ transition: 0.1s;
205
+ }
206
+
207
+ .file-icon img {
208
+ width: 100%;
209
+ height: 100%;
210
+ }
211
+
212
+ .icon:hover {
213
+ background: #eee;
214
+ }
215
+
216
+ .icon:hover :global(> *) {
217
+ color: var(--block-info-text-color);
218
+ }
219
+
220
+ .icon :global(> *) {
221
+ transform: rotate(90deg);
222
+ transform-origin: 40% 50%;
223
+ transition: 0.2s;
224
+ color: var(--color-accent);
225
+ }
226
+
227
+ .no-checkbox {
228
+ width: 18px;
229
+ height: 18px;
230
+ }
231
+
232
+ ul.root .no-checkbox {
233
+ display: none;
234
+ }
235
+
236
+ .hidden :global(> *) {
237
+ transform: rotate(0);
238
+ color: var(--body-text-color-subdued);
239
+ }
240
+
241
+ ul {
242
+ margin-left: 26px;
243
+ padding-left: 0;
244
+ list-style: none;
245
+ }
246
+
247
+ ul.root {
248
+ margin-left: 8px;
249
+ }
250
+
251
+ ul.no-checkboxes:not(.root) {
252
+ margin-left: 20px;
253
+ }
254
+
255
+ li {
256
+ margin-left: 0;
257
+ padding-left: 0;
258
+ align-items: center;
259
+ margin: 8px 0;
260
+ font-family: var(--font-mono);
261
+ font-size: var(--scale-00);
262
+ overflow-wrap: anywhere;
263
+ word-break: break-word;
264
+ }
265
+
266
+ .wrap {
267
+ display: flex;
268
+ gap: 8px;
269
+ align-items: center;
270
+ }
271
+
272
+ .wrap.selected {
273
+ background-color: var(--color-accent-soft);
274
+ border-radius: var(--radius-sm);
275
+ margin-left: -4px;
276
+ padding-left: 4px;
277
+ }
278
+
279
+ .wrap.selectable {
280
+ cursor: pointer;
281
+ border-radius: var(--radius-sm);
282
+ margin-left: -4px;
283
+ padding-left: 4px;
284
+ padding-right: 4px;
285
+ }
286
+
287
+ .wrap.selectable:hover {
288
+ background-color: var(--border-color-accent);
289
+ }
290
+
291
+ .item-name {
292
+ flex: 1;
293
+ padding: 2px 4px;
294
+ border-radius: var(--radius-sm);
295
+ margin-right: -4px;
296
+ }
297
+ </style>
6.2.1/fileexplorer/shared/types.ts ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ export interface FileNode {
2
+ type: "file" | "folder";
3
+ name: string;
4
+ valid?: boolean;
5
+ }
6.2.1/fileexplorer/types.ts ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import type { LoadingStatus } from "@gradio/statustracker";
2
+ import type { SelectData, CustomButton } from "@gradio/utils";
3
+ import type { FileNode } from "./shared/types";
4
+
5
+ export interface FileExplorerProps {
6
+ value: string[][];
7
+ height: number | string | undefined;
8
+ min_height: number | string | undefined;
9
+ max_height: number | string | undefined;
10
+ file_count: "single" | "multiple";
11
+ root_dir: string;
12
+ glob: string;
13
+ ignore_glob: string;
14
+ _selectable: boolean;
15
+ server: {
16
+ ls: (path: string[]) => Promise<FileNode[]>;
17
+ };
18
+ buttons: (string | CustomButton)[] | null;
19
+ }
20
+
21
+ export interface FileExplorerEvents {
22
+ change: never;
23
+ input: never;
24
+ select: SelectData;
25
+ clear_status: LoadingStatus;
26
+ custom_button_click: { id: number };
27
+ }