nodes/packages/ui/src/lib/Input.svelte

23 lines
726 B
Svelte
Raw Normal View History

2024-03-14 16:55:11 +01:00
<script lang="ts">
import Checkbox from "$lib/elements/Checkbox.svelte";
import Float from "$lib/elements/Float.svelte";
import Integer from "$lib/elements/Integer.svelte";
import Select from "$lib/elements/Select.svelte";
2024-04-04 19:17:27 +02:00
import type { NodeInput } from "@nodes/types";
2024-04-04 19:17:27 +02:00
export let input: NodeInput;
export let value: any;
2024-04-15 22:13:43 +02:00
export let id: string;
2024-03-14 16:55:11 +01:00
</script>
{#if input.type === "float"}
2024-04-18 18:39:24 +02:00
<Float {id} bind:value min={input?.min} max={input?.max} />
2024-03-14 16:55:11 +01:00
{:else if input.type === "integer"}
2024-04-18 18:39:24 +02:00
<Integer {id} bind:value min={input?.min} max={input?.max} />
2024-03-14 16:55:11 +01:00
{:else if input.type === "boolean"}
2024-04-15 22:13:43 +02:00
<Checkbox {id} bind:value />
2024-03-14 16:55:11 +01:00
{:else if input.type === "select"}
2024-04-18 18:39:24 +02:00
<Select {id} bind:value options={input.options} />
2024-03-14 16:55:11 +01:00
{/if}