43 lines
881 B
Svelte
43 lines
881 B
Svelte
<script lang="ts">
|
|
import { Pagination as PaginationPrimitive } from "bits-ui";
|
|
import { cn } from "@/lib/utils.js";
|
|
import { buttonVariants, type ButtonSize } from "@/components/ui/button/index.js";
|
|
let {
|
|
ref = $bindable(null),
|
|
class: className,
|
|
size = "icon",
|
|
isActive,
|
|
page,
|
|
children,
|
|
...restProps
|
|
}: PaginationPrimitive.PageProps & {
|
|
size?: ButtonSize;
|
|
isActive: boolean;
|
|
} = $props();
|
|
</script>
|
|
|
|
{#snippet Fallback()}
|
|
{page.value}
|
|
{/snippet}
|
|
|
|
<PaginationPrimitive.Page
|
|
bind:ref
|
|
{page}
|
|
aria-current={isActive ? "page" : undefined}
|
|
data-slot="pagination-link"
|
|
data-active={isActive}
|
|
data-size={size}
|
|
class={cn(
|
|
buttonVariants({ size, variant: isActive ? "outline" : "ghost" }),
|
|
"cn-pagination-link",
|
|
className
|
|
)}
|
|
{...restProps}
|
|
>
|
|
{#if children}
|
|
{@render children?.()}
|
|
{:else}
|
|
{@render Fallback()}
|
|
{/if}
|
|
</PaginationPrimitive.Page>
|