Upload folder using huggingface_hub
Browse files
6.2.0/dropdown/Index.svelte
CHANGED
|
@@ -9,7 +9,7 @@
|
|
| 9 |
import { Gradio } from "@gradio/utils";
|
| 10 |
import Multiselect from "./shared/Multiselect.svelte";
|
| 11 |
import Dropdown from "./shared/Dropdown.svelte";
|
| 12 |
-
import { Block } from "@gradio/atoms";
|
| 13 |
import { StatusTracker } from "@gradio/statustracker";
|
| 14 |
import type { DropdownProps, DropdownEvents } from "./types.ts";
|
| 15 |
|
|
@@ -46,6 +46,10 @@
|
|
| 46 |
container={gradio.shared.container}
|
| 47 |
allow_custom_value={gradio.props.allow_custom_value}
|
| 48 |
filterable={gradio.props.filterable}
|
|
|
|
|
|
|
|
|
|
|
|
|
| 49 |
on_change={() => gradio.dispatch("change")}
|
| 50 |
on_input={() => gradio.dispatch("input")}
|
| 51 |
on_select={(data) => gradio.dispatch("select", data)}
|
|
|
|
| 9 |
import { Gradio } from "@gradio/utils";
|
| 10 |
import Multiselect from "./shared/Multiselect.svelte";
|
| 11 |
import Dropdown from "./shared/Dropdown.svelte";
|
| 12 |
+
import { Block, IconButtonWrapper } from "@gradio/atoms";
|
| 13 |
import { StatusTracker } from "@gradio/statustracker";
|
| 14 |
import type { DropdownProps, DropdownEvents } from "./types.ts";
|
| 15 |
|
|
|
|
| 46 |
container={gradio.shared.container}
|
| 47 |
allow_custom_value={gradio.props.allow_custom_value}
|
| 48 |
filterable={gradio.props.filterable}
|
| 49 |
+
buttons={gradio.props.buttons}
|
| 50 |
+
on_custom_button_click={(id) => {
|
| 51 |
+
gradio.dispatch("custom_button_click", { id });
|
| 52 |
+
}}
|
| 53 |
on_change={() => gradio.dispatch("change")}
|
| 54 |
on_input={() => gradio.dispatch("input")}
|
| 55 |
on_select={(data) => gradio.dispatch("select", data)}
|
6.2.0/dropdown/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
| 1 |
{
|
| 2 |
"name": "@gradio/dropdown",
|
| 3 |
-
"version": "0.
|
| 4 |
"description": "Gradio UI packages",
|
| 5 |
"type": "module",
|
| 6 |
"author": "",
|
|
|
|
| 1 |
{
|
| 2 |
"name": "@gradio/dropdown",
|
| 3 |
+
"version": "0.11.0",
|
| 4 |
"description": "Gradio UI packages",
|
| 5 |
"type": "module",
|
| 6 |
"author": "",
|
6.2.0/dropdown/shared/Dropdown.svelte
CHANGED
|
@@ -1,9 +1,13 @@
|
|
| 1 |
<script lang="ts">
|
| 2 |
import DropdownOptions from "./DropdownOptions.svelte";
|
| 3 |
-
import { BlockTitle } from "@gradio/atoms";
|
| 4 |
import { DropdownArrow } from "@gradio/icons";
|
| 5 |
import { handle_filter, handle_shared_keys } from "./utils";
|
| 6 |
-
import type {
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7 |
import { tick } from "svelte";
|
| 8 |
|
| 9 |
const is_browser = typeof window !== "undefined";
|
|
@@ -18,6 +22,8 @@
|
|
| 18 |
container = true,
|
| 19 |
allow_custom_value = false,
|
| 20 |
filterable = true,
|
|
|
|
|
|
|
| 21 |
on_change,
|
| 22 |
on_input,
|
| 23 |
on_select,
|
|
@@ -34,6 +40,8 @@
|
|
| 34 |
container?: boolean;
|
| 35 |
allow_custom_value?: boolean;
|
| 36 |
filterable?: boolean;
|
|
|
|
|
|
|
| 37 |
on_change?: (value: string | number | null) => void;
|
| 38 |
on_input?: () => void;
|
| 39 |
on_select?: (data: SelectData) => void;
|
|
@@ -161,6 +169,9 @@
|
|
| 161 |
</script>
|
| 162 |
|
| 163 |
<div class:container>
|
|
|
|
|
|
|
|
|
|
| 164 |
<BlockTitle {show_label} {info}>{label}</BlockTitle>
|
| 165 |
|
| 166 |
<div class="wrap">
|
|
|
|
| 1 |
<script lang="ts">
|
| 2 |
import DropdownOptions from "./DropdownOptions.svelte";
|
| 3 |
+
import { BlockTitle, IconButtonWrapper } from "@gradio/atoms";
|
| 4 |
import { DropdownArrow } from "@gradio/icons";
|
| 5 |
import { handle_filter, handle_shared_keys } from "./utils";
|
| 6 |
+
import type {
|
| 7 |
+
SelectData,
|
| 8 |
+
KeyUpData,
|
| 9 |
+
CustomButton as CustomButtonType
|
| 10 |
+
} from "@gradio/utils";
|
| 11 |
import { tick } from "svelte";
|
| 12 |
|
| 13 |
const is_browser = typeof window !== "undefined";
|
|
|
|
| 22 |
container = true,
|
| 23 |
allow_custom_value = false,
|
| 24 |
filterable = true,
|
| 25 |
+
buttons = null,
|
| 26 |
+
on_custom_button_click = null,
|
| 27 |
on_change,
|
| 28 |
on_input,
|
| 29 |
on_select,
|
|
|
|
| 40 |
container?: boolean;
|
| 41 |
allow_custom_value?: boolean;
|
| 42 |
filterable?: boolean;
|
| 43 |
+
buttons?: (string | CustomButtonType)[] | null;
|
| 44 |
+
on_custom_button_click?: ((id: number) => void) | null;
|
| 45 |
on_change?: (value: string | number | null) => void;
|
| 46 |
on_input?: () => void;
|
| 47 |
on_select?: (data: SelectData) => void;
|
|
|
|
| 169 |
</script>
|
| 170 |
|
| 171 |
<div class:container>
|
| 172 |
+
{#if show_label && buttons && buttons.length > 0}
|
| 173 |
+
<IconButtonWrapper {buttons} {on_custom_button_click} />
|
| 174 |
+
{/if}
|
| 175 |
<BlockTitle {show_label} {info}>{label}</BlockTitle>
|
| 176 |
|
| 177 |
<div class="wrap">
|
6.2.0/dropdown/types.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
| 1 |
-
import type { KeyUpData, SelectData } from "@gradio/utils";
|
| 2 |
|
| 3 |
export type Item = string | number;
|
| 4 |
|
|
@@ -10,6 +10,7 @@ export interface DropdownProps {
|
|
| 10 |
value: Item | Item[];
|
| 11 |
info: string;
|
| 12 |
filterable: boolean;
|
|
|
|
| 13 |
}
|
| 14 |
|
| 15 |
export interface DropdownEvents {
|
|
@@ -19,4 +20,5 @@ export interface DropdownEvents {
|
|
| 19 |
focus: never;
|
| 20 |
blur: never;
|
| 21 |
key_up: KeyUpData;
|
|
|
|
| 22 |
}
|
|
|
|
| 1 |
+
import type { KeyUpData, SelectData, CustomButton } from "@gradio/utils";
|
| 2 |
|
| 3 |
export type Item = string | number;
|
| 4 |
|
|
|
|
| 10 |
value: Item | Item[];
|
| 11 |
info: string;
|
| 12 |
filterable: boolean;
|
| 13 |
+
buttons: (string | CustomButton)[] | null;
|
| 14 |
}
|
| 15 |
|
| 16 |
export interface DropdownEvents {
|
|
|
|
| 20 |
focus: never;
|
| 21 |
blur: never;
|
| 22 |
key_up: KeyUpData;
|
| 23 |
+
custom_button_click: { id: number };
|
| 24 |
}
|