@gradio/multimodaltextbox 0.2.1 → 0.2.2

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,19 @@
1
1
  # @gradio/multimodaltextbox
2
2
 
3
+ ## 0.2.2
4
+
5
+ ### Fixes
6
+
7
+ - [#7848](https://github.com/gradio-app/gradio/pull/7848) [`8d7b3ca`](https://github.com/gradio-app/gradio/commit/8d7b3caebd8f95b1372f8412cadbb5862766c365) - Multimodal Textbox Loading + other fixes. Thanks @dawoodkhan82!
8
+
9
+ ### Dependency updates
10
+
11
+ - @gradio/atoms@0.6.1
12
+ - @gradio/statustracker@0.4.10
13
+ - @gradio/icons@0.3.4
14
+ - @gradio/upload@0.8.2
15
+ - @gradio/image@0.9.9
16
+
3
17
  ## 0.2.1
4
18
 
5
19
  ### Dependency updates
package/Index.svelte CHANGED
@@ -38,7 +38,7 @@
38
38
  export let container = true;
39
39
  export let scale: number | null = null;
40
40
  export let min_width: number | undefined = undefined;
41
- export let submit_btn = "⌲";
41
+ export let submit_btn: string | null = null;
42
42
  export let loading_status: LoadingStatus | undefined = undefined;
43
43
  export let value_is_output = false;
44
44
  export let rtl = false;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gradio/multimodaltextbox",
3
- "version": "0.2.1",
3
+ "version": "0.2.2",
4
4
  "description": "Gradio UI packages",
5
5
  "type": "module",
6
6
  "author": "",
@@ -14,12 +14,12 @@
14
14
  "./package.json": "./package.json"
15
15
  },
16
16
  "dependencies": {
17
- "@gradio/atoms": "^0.6.0",
18
- "@gradio/statustracker": "^0.4.9",
19
- "@gradio/icons": "^0.3.3",
20
- "@gradio/utils": "^0.3.0",
21
- "@gradio/upload": "^0.8.1",
22
- "@gradio/image": "^0.9.8",
23
- "@gradio/client": "^0.14.0"
17
+ "@gradio/atoms": "^0.6.1",
18
+ "@gradio/icons": "^0.3.4",
19
+ "@gradio/upload": "^0.8.2",
20
+ "@gradio/image": "^0.9.9",
21
+ "@gradio/statustracker": "^0.4.10",
22
+ "@gradio/client": "^0.14.0",
23
+ "@gradio/utils": "^0.3.0"
24
24
  }
25
25
  }
@@ -9,8 +9,8 @@
9
9
  import { BlockTitle } from "@gradio/atoms";
10
10
  import { Upload } from "@gradio/upload";
11
11
  import { Image } from "@gradio/image/shared";
12
- import type { FileData } from "@gradio/client";
13
- import { Clear, File, Music, Video } from "@gradio/icons";
12
+ import type { FileData, upload } from "@gradio/client";
13
+ import { Clear, File, Music, Video, Send } from "@gradio/icons";
14
14
  import type { SelectData } from "@gradio/utils";
15
15
 
16
16
  export let value: { text: string; files: FileData[] } = {
@@ -27,7 +27,7 @@
27
27
  export let show_label = true;
28
28
  export let container = true;
29
29
  export let max_lines: number;
30
- export let submit_btn = "⌲";
30
+ export let submit_btn: string | null = null;
31
31
  export let rtl = false;
32
32
  export let autofocus = false;
33
33
  export let text_align: "left" | "right" | undefined = undefined;
@@ -40,6 +40,7 @@
40
40
  let previous_scroll_top = 0;
41
41
  let user_has_scrolled_up = false;
42
42
  let dragging = false;
43
+ let uploading = false;
43
44
  let oldValue = value.text;
44
45
  $: dispatch("drag", dragging);
45
46
 
@@ -193,22 +194,29 @@
193
194
  filetype={accept_file_types}
194
195
  {root}
195
196
  bind:dragging
197
+ bind:uploading
196
198
  disable_click={true}
197
199
  bind:hidden_upload
198
200
  >
199
- {#if submit_btn}
201
+ {#if submit_btn !== null}
200
202
  <button class:disabled class="submit-button" on:click={handle_submit}
201
203
  >{submit_btn}</button
202
204
  >
205
+ {:else}
206
+ <button class:disabled class="submit-button" on:click={handle_submit}
207
+ ><Send /></button
208
+ >
203
209
  {/if}
204
210
  <button class:disabled class="plus-button" on:click={handle_upload_click}
205
211
  >+</button
206
212
  >
207
- {#if value.files.length > 0}
213
+ {#if value.files.length > 0 || uploading}
208
214
  <div
209
215
  class="thumbnails scroll-hide"
210
216
  data-testid="container_el"
211
- style="display: {value.files.length > 0 ? 'flex' : 'none'};"
217
+ style="display: {value.files.length > 0 || uploading
218
+ ? 'flex'
219
+ : 'none'};"
212
220
  >
213
221
  {#each value.files as file, index}
214
222
  <button class="thumbnail-item thumbnail-small">
@@ -235,6 +243,9 @@
235
243
  {/if}
236
244
  </button>
237
245
  {/each}
246
+ {#if uploading}
247
+ <div class="loader"></div>
248
+ {/if}
238
249
  </div>
239
250
  {/if}
240
251
  <textarea
@@ -288,6 +299,7 @@
288
299
  margin-bottom: 0px;
289
300
  margin-left: 30px;
290
301
  padding-top: 12px;
302
+ resize: none;
291
303
  }
292
304
 
293
305
  textarea:disabled {
@@ -335,11 +347,41 @@
335
347
  padding-left: 2px;
336
348
  }
337
349
 
350
+ .submit-button :global(svg) {
351
+ height: 23px;
352
+ width: 23px;
353
+ padding-left: 4px;
354
+ padding-top: 2px;
355
+ }
356
+
338
357
  .plus-button {
339
358
  left: 10px;
340
359
  margin-right: 5px;
341
360
  }
342
361
 
362
+ .loader {
363
+ display: flex;
364
+ justify-content: center;
365
+ align-items: center;
366
+ --ring-color: transparent;
367
+ position: relative;
368
+ border: 5px solid #f3f3f3;
369
+ border-top: 5px solid var(--color-accent);
370
+ border-radius: 50%;
371
+ width: 25px;
372
+ height: 25px;
373
+ animation: spin 2s linear infinite;
374
+ }
375
+
376
+ @keyframes spin {
377
+ 0% {
378
+ transform: rotate(0deg);
379
+ }
380
+ 100% {
381
+ transform: rotate(360deg);
382
+ }
383
+ }
384
+
343
385
  .thumbnails :global(img) {
344
386
  width: var(--size-full);
345
387
  height: var(--size-full);