2022-02-07 22:34:53 +08:00
|
|
|
<script lang="ts">
|
2023-08-24 04:48:10 +08:00
|
|
|
import type { Gradio, SelectData } from "@gradio/utils";
|
2023-08-04 06:01:18 +08:00
|
|
|
import Radio from "../shared";
|
2022-04-26 22:48:39 +08:00
|
|
|
import { Block } from "@gradio/atoms";
|
2023-08-04 06:01:18 +08:00
|
|
|
import { StatusTracker } from "@gradio/statustracker";
|
2023-08-16 02:21:41 +08:00
|
|
|
import type { LoadingStatus } from "@gradio/statustracker";
|
2023-08-18 19:36:52 +08:00
|
|
|
import { _ } from "svelte-i18n";
|
2022-03-08 21:35:42 +08:00
|
|
|
|
2023-08-18 19:36:52 +08:00
|
|
|
export let label = $_("radio.radio");
|
2023-02-23 07:16:15 +08:00
|
|
|
export let info: string | undefined = undefined;
|
2023-06-29 02:26:34 +08:00
|
|
|
export let elem_id = "";
|
|
|
|
export let elem_classes: string[] = [];
|
|
|
|
export let visible = true;
|
2023-08-17 02:27:39 +08:00
|
|
|
export let value: string | number | null = null;
|
2023-06-29 02:26:34 +08:00
|
|
|
export let value_is_output = false;
|
2023-08-17 02:27:39 +08:00
|
|
|
export let choices: [string, number][] = [];
|
2022-04-27 18:47:15 +08:00
|
|
|
export let show_label: boolean;
|
2023-06-29 02:26:34 +08:00
|
|
|
export let container = false;
|
2023-06-22 03:34:12 +08:00
|
|
|
export let scale: number | null = null;
|
2023-06-08 09:35:31 +08:00
|
|
|
export let min_width: number | undefined = undefined;
|
2022-05-06 03:05:05 +08:00
|
|
|
export let loading_status: LoadingStatus;
|
2023-08-24 04:48:10 +08:00
|
|
|
export let gradio: Gradio<{
|
|
|
|
change: never;
|
|
|
|
select: SelectData;
|
|
|
|
input: never;
|
|
|
|
}>;
|
2022-02-01 21:45:55 +08:00
|
|
|
</script>
|
|
|
|
|
2022-06-02 01:02:18 +08:00
|
|
|
<Block
|
2022-06-17 07:49:54 +08:00
|
|
|
{visible}
|
2022-06-02 01:02:18 +08:00
|
|
|
type="fieldset"
|
|
|
|
{elem_id}
|
2023-03-16 05:01:53 +08:00
|
|
|
{elem_classes}
|
2023-06-08 09:35:31 +08:00
|
|
|
{container}
|
|
|
|
{scale}
|
|
|
|
{min_width}
|
2022-06-02 01:02:18 +08:00
|
|
|
>
|
2022-05-06 03:05:05 +08:00
|
|
|
<StatusTracker {...loading_status} />
|
2022-04-26 22:48:39 +08:00
|
|
|
|
|
|
|
<Radio
|
|
|
|
bind:value
|
2023-05-16 09:36:57 +08:00
|
|
|
bind:value_is_output
|
2022-04-26 22:48:39 +08:00
|
|
|
{label}
|
2023-02-23 07:16:15 +08:00
|
|
|
{info}
|
2022-05-17 01:22:09 +08:00
|
|
|
{elem_id}
|
2022-04-27 18:47:15 +08:00
|
|
|
{show_label}
|
2022-04-26 22:48:39 +08:00
|
|
|
{choices}
|
2023-08-24 04:48:10 +08:00
|
|
|
on:change={() => gradio.dispatch("change")}
|
|
|
|
on:input={() => gradio.dispatch("input")}
|
|
|
|
on:select={(e) => gradio.dispatch("select", e.detail)}
|
2022-04-26 22:48:39 +08:00
|
|
|
/>
|
|
|
|
</Block>
|