2022-02-02 22:02:09 +08:00
|
|
|
<script lang="ts">
|
2022-03-08 21:35:42 +08:00
|
|
|
import { Checkbox } from "@gradio/form";
|
2023-02-23 07:16:15 +08:00
|
|
|
import { Block, Info } from "@gradio/atoms";
|
2022-04-26 22:48:39 +08:00
|
|
|
import StatusTracker from "../StatusTracker/StatusTracker.svelte";
|
2022-05-06 03:05:05 +08:00
|
|
|
import type { LoadingStatus } from "../StatusTracker/types";
|
2022-06-02 01:02:18 +08:00
|
|
|
import type { Styles } from "@gradio/utils";
|
2022-03-12 00:00:48 +08:00
|
|
|
|
2022-05-12 12:40:41 +08:00
|
|
|
export let elem_id: string = "";
|
2023-03-16 05:01:53 +08:00
|
|
|
export let elem_classes: Array<string> = [];
|
2022-06-17 07:49:54 +08:00
|
|
|
export let visible: boolean = true;
|
2022-03-12 00:00:48 +08:00
|
|
|
export let value: boolean = false;
|
2023-05-16 09:36:57 +08:00
|
|
|
export let value_is_output: boolean = false;
|
2022-04-21 01:54:44 +08:00
|
|
|
export let label: string = "Checkbox";
|
2023-02-23 07:16:15 +08:00
|
|
|
export let info: string | undefined = undefined;
|
2022-03-12 00:00:48 +08:00
|
|
|
export let mode: "static" | "dynamic";
|
2022-06-02 01:02:18 +08:00
|
|
|
export let style: Styles = {};
|
2022-05-06 03:05:05 +08:00
|
|
|
export let loading_status: LoadingStatus;
|
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
|
|
|
{elem_id}
|
2023-03-16 05:01:53 +08:00
|
|
|
{elem_classes}
|
2022-06-02 01:02:18 +08:00
|
|
|
disable={typeof style.container === "boolean" && !style.container}
|
|
|
|
>
|
2022-05-06 03:05:05 +08:00
|
|
|
<StatusTracker {...loading_status} />
|
2022-04-26 22:48:39 +08:00
|
|
|
|
2023-02-23 07:16:15 +08:00
|
|
|
{#if info}
|
|
|
|
<Info>{info}</Info>
|
|
|
|
{/if}
|
2023-03-14 08:12:41 +08:00
|
|
|
<Checkbox
|
|
|
|
{label}
|
|
|
|
bind:value
|
2023-05-16 09:36:57 +08:00
|
|
|
bind:value_is_output
|
2023-03-14 08:12:41 +08:00
|
|
|
on:change
|
2023-05-16 09:36:57 +08:00
|
|
|
on:input
|
2023-03-14 08:12:41 +08:00
|
|
|
on:select
|
|
|
|
disabled={mode === "static"}
|
|
|
|
/>
|
2022-04-26 22:48:39 +08:00
|
|
|
</Block>
|