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
@@ -0,0 +1,43 @@
<script lang="ts">
import { boxWith, mergeProps } from "svelte-toolbelt";
import type { PaginationPageProps } from "../types.js";
import { PaginationPageState } from "../pagination.svelte.js";
import { createId } from "../../../internal/create-id.js";
const uid = $props.id();
let {
id = createId(uid),
page,
child,
children,
type = "button",
ref = $bindable(null),
disabled = false,
...restProps
}: PaginationPageProps = $props();
const pageState = PaginationPageState.create({
id: boxWith(() => id),
page: boxWith(() => page),
ref: boxWith(
() => ref,
(v) => (ref = v)
),
disabled: boxWith(() => Boolean(disabled)),
});
const mergedProps = $derived(mergeProps(restProps, pageState.props, { type }));
</script>
{#if child}
{@render child({ props: mergedProps })}
{:else}
<button {...mergedProps}>
{#if children}
{@render children?.()}
{:else}
{page.value}
{/if}
</button>
{/if}