@gradio/upload 0.7.7 → 0.8.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 CHANGED
@@ -1,5 +1,25 @@
1
1
  # @gradio/upload
2
2
 
3
+ ## 0.8.1
4
+
5
+ ### Dependency updates
6
+
7
+ - @gradio/upload@0.8.1
8
+ - @gradio/wasm@0.10.0
9
+ - @gradio/atoms@0.6.0
10
+
11
+ ## 0.8.0
12
+
13
+ ### Features
14
+
15
+ - [#7420](https://github.com/gradio-app/gradio/pull/7420) [`15da39f`](https://github.com/gradio-app/gradio/commit/15da39fca01d09a30cf47e7e72d7efa5052f61f8) - Multimodal Textbox (Chat Input Component). Thanks @dawoodkhan82!
16
+
17
+ ### Dependency updates
18
+
19
+ - @gradio/client@0.14.0
20
+ - @gradio/upload@0.8.0
21
+ - @gradio/wasm@0.9.0
22
+
3
23
  ## 0.7.7
4
24
 
5
25
  ### Dependency updates
package/package.json CHANGED
@@ -1,18 +1,18 @@
1
1
  {
2
2
  "name": "@gradio/upload",
3
- "version": "0.7.7",
3
+ "version": "0.8.1",
4
4
  "description": "Gradio UI packages",
5
5
  "type": "module",
6
6
  "main": "src/index.ts",
7
7
  "author": "",
8
8
  "license": "ISC",
9
9
  "dependencies": {
10
+ "@gradio/atoms": "^0.6.0",
11
+ "@gradio/client": "^0.14.0",
12
+ "@gradio/upload": "^0.8.1",
10
13
  "@gradio/icons": "^0.3.3",
11
- "@gradio/client": "^0.13.0",
12
14
  "@gradio/utils": "^0.3.0",
13
- "@gradio/atoms": "^0.5.3",
14
- "@gradio/wasm": "^0.8.0",
15
- "@gradio/upload": "^0.7.7"
15
+ "@gradio/wasm": "^0.10.0"
16
16
  },
17
17
  "main_changeset": true,
18
18
  "exports": {
package/src/Upload.svelte CHANGED
@@ -16,6 +16,7 @@
16
16
  export let hidden = false;
17
17
  export let format: "blob" | "file" = "file";
18
18
  export let uploading = false;
19
+ export let hidden_upload: HTMLInputElement | null = null;
19
20
 
20
21
  let upload_id: string;
21
22
  let file_data: FileData[];
@@ -24,7 +25,6 @@
24
25
  // Needed for wasm support
25
26
  const upload_fn = getContext<typeof upload_files>("upload_files");
26
27
 
27
- let hidden_upload: HTMLInputElement;
28
28
  const dispatch = createEventDispatcher();
29
29
  const validFileTypes = ["image", "video", "audio", "text", "file"];
30
30
  const processFileType = (type: string): string => {
@@ -70,8 +70,10 @@
70
70
 
71
71
  export function open_file_upload(): void {
72
72
  if (disable_click) return;
73
- hidden_upload.value = "";
74
- hidden_upload.click();
73
+ if (hidden_upload) {
74
+ hidden_upload.value = "";
75
+ hidden_upload.click();
76
+ }
75
77
  }
76
78
 
77
79
  async function handle_upload(
@@ -92,7 +94,9 @@
92
94
  if (!files.length) {
93
95
  return;
94
96
  }
95
- let _files: File[] = files.map((f) => new File([f], f.name));
97
+ let _files: File[] = files.map(
98
+ (f) => new File([f], f.name, { type: f.type })
99
+ );
96
100
  file_data = await prepare_files(_files);
97
101
  return await handle_upload(file_data);
98
102
  }
@@ -191,6 +195,7 @@
191
195
  class:center
192
196
  class:boundedheight
193
197
  class:flex
198
+ class:disable_click
194
199
  style:height="100%"
195
200
  tabindex={hidden ? -1 : 0}
196
201
  on:drag|preventDefault|stopPropagation
@@ -212,7 +217,7 @@
212
217
  type="file"
213
218
  bind:this={hidden_upload}
214
219
  on:change={load_files_from_upload}
215
- accept={accept_file_types}
220
+ accept={accept_file_types || undefined}
216
221
  multiple={file_count === "multiple" || undefined}
217
222
  webkitdirectory={file_count === "directory" || undefined}
218
223
  mozdirectory={file_count === "directory" || undefined}
@@ -240,9 +245,13 @@
240
245
  }
241
246
  .flex {
242
247
  display: flex;
248
+ flex-direction: column;
243
249
  justify-content: center;
244
250
  align-items: center;
245
251
  }
252
+ .disable_click {
253
+ cursor: default;
254
+ }
246
255
 
247
256
  input {
248
257
  display: none;