Files
dickloads/src/components/UnitInput.svelte

31 lines
558 B
Svelte

<script lang="ts">
/**
* UnitInput — controlled numeric input.
* Phase 2: number input only. NL field added in Phase 3.
*/
let {
value,
onchange
}: {
value: number;
onchange: (v: number) => void;
} = $props();
function handleInput(e: Event) {
const input = e.currentTarget as HTMLInputElement;
const parsed = parseFloat(input.value);
if (!isNaN(parsed)) {
onchange(parsed);
}
}
</script>
<input
type="number"
step="any"
value={value}
oninput={handleInput}
aria-label="Input value"
/>