2026-01-30 22:14:12 +00:00
|
|
|
<script lang="ts">
|
|
|
|
|
import cx from "classnames"
|
2026-09-12 17:03:24 +00:00
|
|
|
import {getContext} from "svelte"
|
2026-01-30 22:14:12 +00:00
|
|
|
import type {Snippet} from "svelte"
|
2026-09-12 17:03:24 +00:00
|
|
|
import type {DialogContext} from "@lib/components/dialog"
|
|
|
|
|
import {DIALOG_CONTEXT} from "@lib/components/dialog"
|
2026-01-30 22:14:12 +00:00
|
|
|
|
2026-09-12 17:03:24 +00:00
|
|
|
type Props = {
|
|
|
|
|
label?: string
|
2026-01-30 22:14:12 +00:00
|
|
|
tag?: string
|
|
|
|
|
class?: string
|
|
|
|
|
children?: Snippet
|
|
|
|
|
[key: string]: any
|
|
|
|
|
}
|
|
|
|
|
|
2026-09-12 17:03:24 +00:00
|
|
|
const {children, label, tag = "div", ...props}: Props = $props()
|
|
|
|
|
|
|
|
|
|
const context = getContext<DialogContext | undefined>(DIALOG_CONTEXT)
|
|
|
|
|
|
|
|
|
|
$effect(() => {
|
|
|
|
|
if (label) {
|
|
|
|
|
return context?.registerLabel(label)
|
|
|
|
|
}
|
|
|
|
|
})
|
2026-01-30 22:14:12 +00:00
|
|
|
</script>
|
|
|
|
|
|
2026-02-03 22:18:58 +00:00
|
|
|
<svelte:element this={tag} {...props} class={cx("flex flex-col overflow-hidden", props.class)}>
|
2026-01-30 22:14:12 +00:00
|
|
|
{@render children?.()}
|
|
|
|
|
</svelte:element>
|