gradio-pr-bot commited on
Commit
667324b
·
verified ·
1 Parent(s): 3d16138

Upload folder using huggingface_hub

Browse files
6.3.0/button/Index.svelte CHANGED
@@ -7,9 +7,21 @@
7
  import type { SharedProps } from "@gradio/utils";
8
 
9
  import Button from "./shared/Button.svelte";
 
 
 
 
 
 
 
 
 
 
 
 
10
 
11
- let _props: { shared_props: SharedProps; props: {} } = $props();
12
- const gradio = new Gradio<never, {}>(_props);
13
 
14
  function handle_click() {
15
  gradio.dispatch("click");
@@ -29,7 +41,7 @@
29
  visible={gradio.shared.visible}
30
  disabled={!gradio.shared.interactive}
31
  link_target={gradio.props.link_target}
32
- on:click={handle_click}
33
  >
34
  {gradio.props.value ?? ""}
35
  </Button>
 
7
  import type { SharedProps } from "@gradio/utils";
8
 
9
  import Button from "./shared/Button.svelte";
10
+ import type { FileData } from "client/js/src";
11
+ interface ButtonProps {
12
+ value: string | null;
13
+ variant: "primary" | "secondary" | "stop";
14
+ size: "sm" | "md" | "lg";
15
+ scale: number;
16
+ link: string | null;
17
+ icon: FileData | null;
18
+ link_target: "_self" | "_blank";
19
+ elem_id: string | null;
20
+ elem_classes?: string[];
21
+ }
22
 
23
+ let _props: { shared_props: SharedProps; props: ButtonProps } = $props();
24
+ const gradio = new Gradio<never, ButtonProps>(_props);
25
 
26
  function handle_click() {
27
  gradio.dispatch("click");
 
41
  visible={gradio.shared.visible}
42
  disabled={!gradio.shared.interactive}
43
  link_target={gradio.props.link_target}
44
+ onclick={handle_click}
45
  >
46
  {gradio.props.value ?? ""}
47
  </Button>
6.3.0/button/package.json CHANGED
@@ -1,6 +1,6 @@
1
  {
2
  "name": "@gradio/button",
3
- "version": "0.6.1",
4
  "description": "Gradio UI packages",
5
  "type": "module",
6
  "author": "",
 
1
  {
2
  "name": "@gradio/button",
3
+ "version": "0.6.2",
4
  "description": "Gradio UI packages",
5
  "type": "module",
6
  "author": "",
6.3.0/button/shared/Button.svelte CHANGED
@@ -1,20 +1,39 @@
1
  <script lang="ts">
2
  import { type FileData } from "@gradio/client";
3
  import { Image } from "@gradio/image/shared";
4
-
5
- export let elem_id = "";
6
- export let elem_classes: string[] = [];
7
- export let visible: boolean | "hidden" = true;
8
- export let variant: "primary" | "secondary" | "stop" | "huggingface" =
9
- "secondary";
10
- export let size: "sm" | "md" | "lg" = "lg";
11
- export let value: string | null = null;
12
- export let link: string | null = null;
13
- export let link_target: "_self" | "_blank" | "_parent" | "_top" = "_self";
14
- export let icon: FileData | null = null;
15
- export let disabled = false;
16
- export let scale: number | null = null;
17
- export let min_width: number | undefined = undefined;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
18
  </script>
19
 
20
  {#if link && link.length > 0}
@@ -40,11 +59,13 @@
40
  restProps={{ alt: `${value} icon`, class: "button-icon" }}
41
  />
42
  {/if}
43
- <slot />
 
 
44
  </a>
45
  {:else}
46
  <button
47
- on:click
48
  class:hidden={visible === false || visible === "hidden"}
49
  class="{size} {variant} {elem_classes.join(' ')}"
50
  style:flex-grow={scale}
@@ -62,7 +83,9 @@
62
  src={icon.url}
63
  />
64
  {/if}
65
- <slot />
 
 
66
  </button>
67
  {/if}
68
 
 
1
  <script lang="ts">
2
  import { type FileData } from "@gradio/client";
3
  import { Image } from "@gradio/image/shared";
4
+ import { type Snippet } from "svelte";
5
+
6
+ let {
7
+ elem_id,
8
+ elem_classes = [],
9
+ visible,
10
+ variant,
11
+ size,
12
+ value,
13
+ link,
14
+ link_target,
15
+ icon,
16
+ disabled,
17
+ scale,
18
+ min_width,
19
+ onclick = () => {},
20
+ children
21
+ }: {
22
+ elem_id: string | null;
23
+ elem_classes: string[] | null;
24
+ visible: boolean | "hidden";
25
+ variant: "primary" | "secondary" | "stop" | "huggingface";
26
+ size: "sm" | "md" | "lg";
27
+ value: string | null;
28
+ link: string | null;
29
+ link_target: "_self" | "_blank" | "_parent" | "_top";
30
+ icon: FileData | null;
31
+ disabled: boolean;
32
+ scale: number | null;
33
+ min_width: number | undefined;
34
+ onclick: () => void;
35
+ children?: Snippet;
36
+ } = $props();
37
  </script>
38
 
39
  {#if link && link.length > 0}
 
59
  restProps={{ alt: `${value} icon`, class: "button-icon" }}
60
  />
61
  {/if}
62
+ {#if children}
63
+ {@render children()}
64
+ {/if}
65
  </a>
66
  {:else}
67
  <button
68
+ {onclick}
69
  class:hidden={visible === false || visible === "hidden"}
70
  class="{size} {variant} {elem_classes.join(' ')}"
71
  style:flex-grow={scale}
 
83
  src={icon.url}
84
  />
85
  {/if}
86
+ {#if children}
87
+ {@render children()}
88
+ {/if}
89
  </button>
90
  {/if}
91