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

28 lines
792 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-18 11:06:45 +02:00
import Slider from "./elements/Slider.svelte";
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 11:06:45 +02:00
{#if input?.element === "slider"}
<Slider {id} bind:value />
{:else}
<Float {id} bind:value />
{/if}
2024-03-14 16:55:11 +01:00
{:else if input.type === "integer"}
2024-04-15 22:13:43 +02:00
<Integer {id} bind:value />
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-15 22:13:43 +02:00
<Select {id} bind:value labels={input.labels} />
2024-03-14 16:55:11 +01:00
{/if}