first commit
This commit is contained in:
commit
e687b4437b
418 files changed
+33577
No files matched your search
@@ -0,0 +1,19 @@
|
||||
<script lang="ts">
|
||||
import type { Snippet } from 'svelte';
|
||||
import { getContext } from 'svelte';
|
||||
import { DIALOG_CONTEXT, type DialogContext } from './context';
|
||||
|
||||
let { asChild = false, children }: { asChild?: boolean; children?: Snippet<[Record<string, unknown>]> } = $props();
|
||||
|
||||
const { setOpen, open } = getContext<DialogContext>(DIALOG_CONTEXT);
|
||||
|
||||
const handleClick = () => setOpen(true);
|
||||
</script>
|
||||
|
||||
{#if asChild}
|
||||
{@render children?.({ onClick: handleClick, 'aria-expanded': open() })}
|
||||
{:else}
|
||||
<button type="button" onclick={handleClick} aria-expanded={open()}>
|
||||
{@render children?.({})}
|
||||
</button>
|
||||
{/if}
|
||||
Reference in new issue
Block a user