Add TS type information

This commit is contained in:
2024-12-13 19:56:47 +01:00
parent f3a0b53ce6
commit c4b635b702
20 changed files with 576 additions and 280 deletions

View File

@ -1,9 +1,25 @@
<script lang="ts">
let { children, type = "text", ...restProps } = $props();
import type { Snippet } from "svelte";
import type { HTMLInputAttributes } from "svelte/elements";
interface InputProps extends HTMLInputAttributes {
children: Snippet;
/** Manually set the label width, to align multiple inputs vertically. Supply value in CSS units. */
labelwidth?: string;
/** The type of the input element, e.g. "text". */
type?: string;
}
let { children, labelwidth = "auto", type = "text", ...restProps }: InputProps = $props();
</script>
<div class="input-group input-group-divider grid-cols-[auto_1fr_auto]">
<div class="input-group-shim select-none text-nowrap text-neutral-900">
<div
class="input-group-shim select-none text-nowrap text-neutral-900"
style="width: {labelwidth};"
>
{@render children()}
</div>
<input {type} {...restProps} />