mirror of
https://github.com/gradio-app/gradio.git
synced 2024-11-21 01:01:05 +08:00
Allow buttons to take null value (#7126)
* allow buttons to take null value * add changeset * add story * format --------- Co-authored-by: gradio-pr-bot <gradio-pr-bot@users.noreply.github.com>
This commit is contained in:
parent
7d53aa13a3
commit
5727b92abc
8
.changeset/all-sites-yell.md
Normal file
8
.changeset/all-sites-yell.md
Normal file
@ -0,0 +1,8 @@
|
||||
---
|
||||
"@gradio/button": patch
|
||||
"@gradio/uploadbutton": patch
|
||||
"@gradio/utils": patch
|
||||
"gradio": patch
|
||||
---
|
||||
|
||||
fix:Allow buttons to take null value
|
@ -10,7 +10,7 @@
|
||||
export let elem_id = "";
|
||||
export let elem_classes: string[] = [];
|
||||
export let visible = true;
|
||||
export let value: string;
|
||||
export let value: string | null;
|
||||
export let variant: "primary" | "secondary" | "stop" = "secondary";
|
||||
export let interactive: boolean;
|
||||
export let size: "sm" | "lg" = "lg";
|
||||
@ -41,5 +41,5 @@
|
||||
disabled={!interactive}
|
||||
on:click={() => gradio.dispatch("click")}
|
||||
>
|
||||
{gradio.i18n(value)}
|
||||
{value ? gradio.i18n(value) : ""}
|
||||
</Button>
|
||||
|
@ -10,7 +10,7 @@
|
||||
export let elem_id = "";
|
||||
export let elem_classes: string[] = [];
|
||||
export let visible = true;
|
||||
export let label: string;
|
||||
export let label: string | null;
|
||||
export let value: null | FileData | FileData[];
|
||||
export let file_count: string;
|
||||
export let file_types: string[] = [];
|
||||
@ -59,5 +59,5 @@
|
||||
on:change={({ detail }) => handle_event(detail, "change")}
|
||||
on:upload={({ detail }) => handle_event(detail, "upload")}
|
||||
>
|
||||
{gradio.i18n(label)}
|
||||
{label ? gradio.i18n(label) : ""}
|
||||
</UploadButton>
|
||||
|
@ -78,3 +78,9 @@
|
||||
visible: false
|
||||
}}
|
||||
/>
|
||||
<Story
|
||||
name="Button with null label (should be collapsed)"
|
||||
args={{
|
||||
label: null
|
||||
}}
|
||||
/>
|
||||
|
@ -12,7 +12,7 @@
|
||||
export let elem_id = "";
|
||||
export let elem_classes: string[] = [];
|
||||
export let visible = true;
|
||||
export let label: string;
|
||||
export let label: string | null;
|
||||
export let value: null | FileData | FileData[];
|
||||
export let file_count: string;
|
||||
export let file_types: string[] = [];
|
||||
|
@ -151,11 +151,6 @@ async function copy_to_clipboard(value: string): Promise<boolean> {
|
||||
return copied;
|
||||
}
|
||||
|
||||
// import { format } from "svelte-i18n";
|
||||
import { get } from "svelte/store";
|
||||
|
||||
// const x = get(format);
|
||||
|
||||
export type I18nFormatter = any;
|
||||
export class Gradio<T extends Record<string, any> = Record<string, any>> {
|
||||
#id: number;
|
||||
|
Loading…
Reference in New Issue
Block a user