UNPKG

bits-ui

Version:

The headless components for Svelte.

91 lines (90 loc) 3.12 kB
import { type ReadableBoxedValues, type WritableBoxedValues } from "svelte-toolbelt"; import type { Page, PageItem } from "./types.js"; import type { BitsKeyboardEvent, BitsMouseEvent, RefAttachment, WithRefOpts } from "../../internal/types.js"; import { type Orientation } from "../../shared/index.js"; interface PaginationRootStateOpts extends WithRefOpts, ReadableBoxedValues<{ count: number; perPage: number; siblingCount: number; orientation: Orientation; loop: boolean; }>, WritableBoxedValues<{ page: number; }> { } export declare class PaginationRootState { static create(opts: PaginationRootStateOpts): PaginationRootState; readonly opts: PaginationRootStateOpts; readonly attachment: RefAttachment; readonly totalPages: number; readonly range: { start: number; end: number; }; readonly pages: PageItem[]; readonly hasPrevPage: boolean; readonly hasNextPage: boolean; constructor(opts: PaginationRootStateOpts); setPage(page: number): void; getPageTriggerNodes(): HTMLElement[]; getButtonNode(type: "prev" | "next"): HTMLElement | null | undefined; prevPage(): void; nextPage(): void; readonly snippetProps: { pages: PageItem[]; range: { start: number; end: number; }; currentPage: number; }; readonly props: { readonly id: string; readonly "data-orientation": "horizontal" | "vertical"; }; } interface PaginationPageStateOpts extends WithRefOpts, ReadableBoxedValues<{ page: Page; disabled: boolean; }> { } export declare class PaginationPageState { #private; static create(opts: PaginationPageStateOpts): PaginationPageState; readonly opts: PaginationPageStateOpts; readonly root: PaginationRootState; readonly attachment: RefAttachment; constructor(opts: PaginationPageStateOpts, root: PaginationRootState); onclick(e: BitsMouseEvent): void; onkeydown(e: BitsKeyboardEvent): void; readonly props: { readonly id: string; readonly "aria-label": `Page ${number}`; readonly "data-value": `${number}`; readonly "data-selected": "" | undefined; readonly onclick: (e: BitsMouseEvent) => void; readonly onkeydown: (e: BitsKeyboardEvent) => void; }; } interface PaginationButtonStateOpts extends WithRefOpts, ReadableBoxedValues<{ disabled: boolean; }> { type: "prev" | "next"; } export declare class PaginationButtonState { #private; static create(opts: PaginationButtonStateOpts): PaginationButtonState; readonly opts: PaginationButtonStateOpts; readonly root: PaginationRootState; readonly attachment: RefAttachment; constructor(opts: PaginationButtonStateOpts, root: PaginationRootState); onclick(e: BitsMouseEvent): void; onkeydown(e: BitsKeyboardEvent): void; readonly props: { readonly id: string; readonly disabled: boolean; readonly onclick: (e: BitsMouseEvent) => void; readonly onkeydown: (e: BitsKeyboardEvent) => void; }; } export {};