This commit is contained in:
eewing
2026-02-17 14:10:16 -06:00
parent 2bca5834c5
commit cf73cd3b4c
11246 changed files with 1690552 additions and 0 deletions
+38
View File
@@ -0,0 +1,38 @@
<script lang="ts">
import { boxWith, mergeProps } from "svelte-toolbelt";
import { SelectTriggerState } from "../select.svelte.js";
import type { SelectTriggerProps } from "../types.js";
import { createId } from "../../../internal/create-id.js";
import { FloatingLayer } from "../../utilities/floating-layer/index.js";
const uid = $props.id();
let {
id = createId(uid),
ref = $bindable(null),
child,
children,
type = "button",
...restProps
}: SelectTriggerProps = $props();
const triggerState = SelectTriggerState.create({
id: boxWith(() => id),
ref: boxWith(
() => ref,
(v) => (ref = v)
),
});
const mergedProps = $derived(mergeProps(restProps, triggerState.props, { type }));
</script>
<FloatingLayer.Anchor {id} ref={triggerState.opts.ref}>
{#if child}
{@render child({ props: mergedProps })}
{:else}
<button {...mergedProps}>
{@render children?.()}
</button>
{/if}
</FloatingLayer.Anchor>