You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
31 lines
1.2 KiB
31 lines
1.2 KiB
<script lang="ts">
|
|
/**
|
|
* Eidos `Menubar.Content` — wraps soma's menubar Content (which adds
|
|
* cross-menu ArrowLeft/Right navigation on top of DropdownMenu.Content).
|
|
* Stamps `data-size` from the Menubar root's size context so each
|
|
* per-menu panel inherits the bar's chosen density without consumers
|
|
* needing to repeat the prop.
|
|
*/
|
|
import * as Menubar from '$soma/components/menubar';
|
|
import type { MenubarContentProps } from './types';
|
|
import { getMenubarSizeContext } from './menubar-context';
|
|
|
|
let { children: bodyContent, ...rest }: MenubarContentProps = $props();
|
|
|
|
const ctx = getMenubarSizeContext();
|
|
const resolvedSize = $derived(ctx?.getSize() ?? 'md');
|
|
|
|
// Spread cast: soma's MenubarContent declares its props as
|
|
// `MenuContentProps & { onkeydown?: ... }` inline (not exported),
|
|
// so the resulting union with HTMLDivElement's full attr set
|
|
// exceeds TS's representable-union depth limit. The runtime types
|
|
// are correct — the cast bypasses the TS-only ceiling.
|
|
const passthrough = $derived(rest as Record<string, unknown>);
|
|
</script>
|
|
|
|
<Menubar.Content {...passthrough} data-size={resolvedSize}>
|
|
{#snippet children(snippetProps)}
|
|
{@render bodyContent?.(snippetProps)}
|
|
{/snippet}
|
|
</Menubar.Content>
|