Files
base/node_modules/bits-ui/dist/bits/menubar/components/menubar-content.svelte
T
eewing ec317eb17c
CI / build (push) Has been skipped
CI / deploy (push) Successful in 1m11s
INIT
2026-02-18 15:17:47 -06:00

39 lines
1.2 KiB
Svelte

<script lang="ts">
import { boxWith, mergeProps } from "svelte-toolbelt";
import type { MenubarContentProps } from "../types.js";
import { MenubarContentState } from "../menubar.svelte.js";
import MenuContent from "../../menu/components/menu-content.svelte";
import { createId } from "../../../internal/create-id.js";
import { noop } from "../../../internal/noop.js";
const uid = $props.id();
let {
ref = $bindable(null),
interactOutsideBehavior = "close",
id = createId(uid),
onInteractOutside = noop,
onFocusOutside = noop,
onCloseAutoFocus = noop,
onOpenAutoFocus = noop,
...restProps
}: MenubarContentProps = $props();
const contentState = MenubarContentState.create({
id: boxWith(() => id),
interactOutsideBehavior: boxWith(() => interactOutsideBehavior),
ref: boxWith(
() => ref,
(v) => (ref = v)
),
onInteractOutside: boxWith(() => onInteractOutside),
onFocusOutside: boxWith(() => onFocusOutside),
onCloseAutoFocus: boxWith(() => onCloseAutoFocus),
onOpenAutoFocus: boxWith(() => onOpenAutoFocus),
});
const mergedProps = $derived(mergeProps(restProps, contentState.props));
</script>
<MenuContent bind:ref {...mergedProps} {...contentState.popperProps} preventScroll={false} />