Files
nodarium/packages/ui/src/lib/Input.svelte
Max Richter 18802fdc10
Some checks failed
🚀 Lint & Test & Deploy / release (pull_request) Failing after 2m45s
fix(ui): add missing types
2026-02-09 15:37:37 +01:00

47 lines
1.1 KiB
Svelte

<script lang="ts">
import type { NodeInput } from '@nodarium/types';
import {
InputCheckbox,
InputColor,
InputNumber,
InputSelect,
InputShape,
InputVec3
} from './index';
interface Props {
input: NodeInput;
value: unknown;
id?: string;
}
let { input, value = $bindable(), id }: Props = $props();
</script>
{#if input.type === 'float'}
<InputNumber
bind:value={value as number}
min={input?.min}
max={input?.max}
step={input?.step}
/>
{:else if input.type === 'shape'}
<InputShape bind:value={value as number[]} />
{:else if input.type === 'color'}
<InputColor bind:value={value as [number, number, number]} />
{:else if input.type === 'integer'}
<InputNumber
bind:value={value as number}
min={input?.min}
max={input?.max}
step={1}
/>
{:else if input.type === 'boolean'}
<InputCheckbox bind:value={value as boolean} {id} />
{:else if input.type === 'select'}
<InputSelect bind:value={value as number} options={input.options} {id} />
{:else if input.type === 'vec3'}
<InputVec3 bind:value={value as [number, number, number]} {id} />
{/if}