Files
eewing cf73cd3b4c INIT
2026-02-17 14:10:16 -06:00

35 lines
773 B
Svelte

<script lang="ts">
import { boxWith, mergeProps } from "svelte-toolbelt";
import { DialogDescriptionState } from "../dialog.svelte.js";
import type { DialogDescriptionProps } from "../types.js";
import { createId } from "../../../internal/create-id.js";
const uid = $props.id();
let {
id = createId(uid),
children,
child,
ref = $bindable(null),
...restProps
}: DialogDescriptionProps = $props();
const descriptionState = DialogDescriptionState.create({
id: boxWith(() => id),
ref: boxWith(
() => ref,
(v) => (ref = v)
),
});
const mergedProps = $derived(mergeProps(restProps, descriptionState.props));
</script>
{#if child}
{@render child({ props: mergedProps })}
{:else}
<div {...mergedProps}>
{@render children?.()}
</div>
{/if}