This commit is contained in:
eewing
2026-02-17 14:10:16 -06:00
parent 2bca5834c5
commit cf73cd3b4c
11246 changed files with 1690552 additions and 0 deletions
+34
View File
@@ -0,0 +1,34 @@
<script lang="ts">
import { boxWith, mergeProps } from "svelte-toolbelt";
import type { LabelRootProps } from "../types.js";
import { LabelRootState } from "../label.svelte.js";
import { createId } from "../../../internal/create-id.js";
const uid = $props.id();
let {
children,
child,
id = createId(uid),
ref = $bindable(null),
for: forProp,
...restProps
}: LabelRootProps = $props();
const rootState = LabelRootState.create({
id: boxWith(() => id),
ref: boxWith(
() => ref,
(v) => (ref = v)
),
});
const mergedProps = $derived(mergeProps(restProps, rootState.props, { for: forProp }));
</script>
{#if child}
{@render child({ props: mergedProps })}
{:else}
<label {...mergedProps} for={forProp}>
{@render children?.()}
</label>
{/if}
+4
View File
@@ -0,0 +1,4 @@
import type { LabelRootProps } from "../types.js";
declare const Label: import("svelte").Component<LabelRootProps, {}, "ref">;
type Label = ReturnType<typeof Label>;
export default Label;