Upload folder using huggingface_hub
Browse files- 6.2.0/textbox/Index.svelte +3 -0
- 6.2.0/textbox/package.json +1 -1
- 6.2.0/textbox/shared/Textbox.svelte +17 -9
- 6.2.0/textbox/types.ts +7 -2
6.2.0/textbox/Index.svelte
CHANGED
|
@@ -101,6 +101,9 @@
|
|
| 101 |
on:focus={() => gradio.dispatch("focus")}
|
| 102 |
on:stop={() => gradio.dispatch("stop")}
|
| 103 |
on:copy={(e) => gradio.dispatch("copy", e.detail)}
|
|
|
|
|
|
|
|
|
|
| 104 |
disabled={!gradio.shared.interactive}
|
| 105 |
/>
|
| 106 |
</Block>
|
|
|
|
| 101 |
on:focus={() => gradio.dispatch("focus")}
|
| 102 |
on:stop={() => gradio.dispatch("stop")}
|
| 103 |
on:copy={(e) => gradio.dispatch("copy", e.detail)}
|
| 104 |
+
on_custom_button_click={(id) => {
|
| 105 |
+
gradio.dispatch("custom_button_click", { id });
|
| 106 |
+
}}
|
| 107 |
disabled={!gradio.shared.interactive}
|
| 108 |
/>
|
| 109 |
</Block>
|
6.2.0/textbox/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
| 1 |
{
|
| 2 |
"name": "@gradio/textbox",
|
| 3 |
-
"version": "0.
|
| 4 |
"description": "Gradio UI packages",
|
| 5 |
"type": "module",
|
| 6 |
"author": "",
|
|
|
|
| 1 |
{
|
| 2 |
"name": "@gradio/textbox",
|
| 3 |
+
"version": "0.13.0",
|
| 4 |
"description": "Gradio UI packages",
|
| 5 |
"type": "module",
|
| 6 |
"author": "",
|
6.2.0/textbox/shared/Textbox.svelte
CHANGED
|
@@ -7,7 +7,11 @@
|
|
| 7 |
} from "svelte";
|
| 8 |
import { BlockTitle, IconButton, IconButtonWrapper } from "@gradio/atoms";
|
| 9 |
import { Copy, Check, Send, Square } from "@gradio/icons";
|
| 10 |
-
import type {
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11 |
import type { InputHTMLAttributes } from "../types";
|
| 12 |
|
| 13 |
export let value = "";
|
|
@@ -21,7 +25,8 @@
|
|
| 21 |
export let container = true;
|
| 22 |
export let max_lines: number | undefined = undefined;
|
| 23 |
export let type: "text" | "password" | "email" = "text";
|
| 24 |
-
export let buttons: string[] =
|
|
|
|
| 25 |
export let submit_btn: string | boolean | null = null;
|
| 26 |
export let stop_btn: string | boolean | null = null;
|
| 27 |
export let rtl = false;
|
|
@@ -68,6 +73,7 @@
|
|
| 68 |
input: string;
|
| 69 |
focus: undefined;
|
| 70 |
copy: CopyData;
|
|
|
|
| 71 |
}>();
|
| 72 |
|
| 73 |
beforeUpdate(() => {
|
|
@@ -243,13 +249,15 @@
|
|
| 243 |
|
| 244 |
<!-- svelte-ignore a11y-autofocus -->
|
| 245 |
<label class:container class:show_textbox_border>
|
| 246 |
-
{#if show_label && buttons.
|
| 247 |
-
<IconButtonWrapper>
|
| 248 |
-
|
| 249 |
-
|
| 250 |
-
|
| 251 |
-
|
| 252 |
-
|
|
|
|
|
|
|
| 253 |
</IconButtonWrapper>
|
| 254 |
{/if}
|
| 255 |
<BlockTitle show_label={validation_error ? true : show_label} {info}
|
|
|
|
| 7 |
} from "svelte";
|
| 8 |
import { BlockTitle, IconButton, IconButtonWrapper } from "@gradio/atoms";
|
| 9 |
import { Copy, Check, Send, Square } from "@gradio/icons";
|
| 10 |
+
import type {
|
| 11 |
+
SelectData,
|
| 12 |
+
CopyData,
|
| 13 |
+
CustomButton as CustomButtonType
|
| 14 |
+
} from "@gradio/utils";
|
| 15 |
import type { InputHTMLAttributes } from "../types";
|
| 16 |
|
| 17 |
export let value = "";
|
|
|
|
| 25 |
export let container = true;
|
| 26 |
export let max_lines: number | undefined = undefined;
|
| 27 |
export let type: "text" | "password" | "email" = "text";
|
| 28 |
+
export let buttons: (string | CustomButtonType)[] | null = null;
|
| 29 |
+
export let on_custom_button_click: ((id: number) => void) | null = null;
|
| 30 |
export let submit_btn: string | boolean | null = null;
|
| 31 |
export let stop_btn: string | boolean | null = null;
|
| 32 |
export let rtl = false;
|
|
|
|
| 73 |
input: string;
|
| 74 |
focus: undefined;
|
| 75 |
copy: CopyData;
|
| 76 |
+
custom_button_click: { component_id: number };
|
| 77 |
}>();
|
| 78 |
|
| 79 |
beforeUpdate(() => {
|
|
|
|
| 249 |
|
| 250 |
<!-- svelte-ignore a11y-autofocus -->
|
| 251 |
<label class:container class:show_textbox_border>
|
| 252 |
+
{#if show_label && buttons && buttons.length > 0}
|
| 253 |
+
<IconButtonWrapper {buttons} {on_custom_button_click}>
|
| 254 |
+
{#if buttons.some((btn) => typeof btn === "string" && btn === "copy")}
|
| 255 |
+
<IconButton
|
| 256 |
+
Icon={copied ? Check : Copy}
|
| 257 |
+
on:click={handle_copy}
|
| 258 |
+
label={copied ? "Copied" : "Copy"}
|
| 259 |
+
/>
|
| 260 |
+
{/if}
|
| 261 |
</IconButtonWrapper>
|
| 262 |
{/if}
|
| 263 |
<BlockTitle show_label={validation_error ? true : show_label} {info}
|
6.2.0/textbox/types.ts
CHANGED
|
@@ -1,4 +1,8 @@
|
|
| 1 |
-
import {
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
import type { LoadingStatus } from "@gradio/statustracker";
|
| 3 |
|
| 4 |
export interface TextboxEvents {
|
|
@@ -11,6 +15,7 @@ export interface TextboxEvents {
|
|
| 11 |
stop: never;
|
| 12 |
clear_status: LoadingStatus;
|
| 13 |
copy: CopyData;
|
|
|
|
| 14 |
}
|
| 15 |
|
| 16 |
export interface TextboxProps {
|
|
@@ -24,7 +29,7 @@ export interface TextboxProps {
|
|
| 24 |
placeholder: string;
|
| 25 |
submit_btn: string;
|
| 26 |
stop_btn: string;
|
| 27 |
-
buttons: string[];
|
| 28 |
autofocus: boolean;
|
| 29 |
autoscroll: boolean;
|
| 30 |
max_length: number;
|
|
|
|
| 1 |
+
import {
|
| 2 |
+
type SelectData,
|
| 3 |
+
type CopyData,
|
| 4 |
+
type CustomButton
|
| 5 |
+
} from "@gradio/utils";
|
| 6 |
import type { LoadingStatus } from "@gradio/statustracker";
|
| 7 |
|
| 8 |
export interface TextboxEvents {
|
|
|
|
| 15 |
stop: never;
|
| 16 |
clear_status: LoadingStatus;
|
| 17 |
copy: CopyData;
|
| 18 |
+
custom_button_click: { id: number };
|
| 19 |
}
|
| 20 |
|
| 21 |
export interface TextboxProps {
|
|
|
|
| 29 |
placeholder: string;
|
| 30 |
submit_btn: string;
|
| 31 |
stop_btn: string;
|
| 32 |
+
buttons: (string | CustomButton)[] | null;
|
| 33 |
autofocus: boolean;
|
| 34 |
autoscroll: boolean;
|
| 35 |
max_length: number;
|