2022-02-07 22:34:53 +08:00
|
|
|
<script lang="ts">
|
2022-03-08 21:35:42 +08:00
|
|
|
import { Radio } from "@gradio/form";
|
2022-04-26 22:48:39 +08:00
|
|
|
import { Block } from "@gradio/atoms";
|
|
|
|
import StatusTracker from "../StatusTracker/StatusTracker.svelte";
|
2022-05-06 03:05:05 +08:00
|
|
|
import type { LoadingStatus } from "../StatusTracker/types";
|
2022-03-08 21:35:42 +08:00
|
|
|
|
2022-04-21 01:54:44 +08:00
|
|
|
export let label: string = "Radio";
|
2022-05-12 12:40:41 +08:00
|
|
|
export let elem_id: string = "";
|
2022-03-12 00:00:48 +08:00
|
|
|
export let value: string = "";
|
|
|
|
export let choices: Array<string> = [];
|
|
|
|
export let mode: "static" | "dynamic";
|
2022-04-22 17:19:59 +08:00
|
|
|
export let form_position: "first" | "last" | "mid" | "single" = "single";
|
2022-04-27 18:47:15 +08:00
|
|
|
export let show_label: boolean;
|
2022-05-12 12:40:41 +08:00
|
|
|
export let style: Record<string, any> = {};
|
2022-03-24 21:08:13 +08:00
|
|
|
|
2022-05-06 03:05:05 +08:00
|
|
|
export let loading_status: LoadingStatus;
|
2022-02-01 21:45:55 +08:00
|
|
|
</script>
|
|
|
|
|
2022-05-12 12:40:41 +08:00
|
|
|
<Block {form_position} type="fieldset" {elem_id} {style}>
|
2022-05-06 03:05:05 +08:00
|
|
|
<StatusTracker {...loading_status} />
|
2022-04-26 22:48:39 +08:00
|
|
|
|
|
|
|
<Radio
|
|
|
|
{form_position}
|
|
|
|
bind:value
|
|
|
|
{label}
|
2022-04-27 18:47:15 +08:00
|
|
|
{show_label}
|
2022-04-26 22:48:39 +08:00
|
|
|
{choices}
|
2022-05-12 12:40:41 +08:00
|
|
|
{style}
|
2022-04-26 22:48:39 +08:00
|
|
|
disabled={mode === "static"}
|
|
|
|
on:change
|
|
|
|
/>
|
|
|
|
</Block>
|