beta-parity-react
Version:
Beta Parity React Components
124 lines • 3.77 kB
TypeScript
import React from 'react';
import './index.css';
import './variables.css';
import { MenuProps } from '../Menu';
export type controlType = {
className?: string;
isActive?: boolean;
icon?: React.ReactNode;
};
export type controlConfigType = {
first?: controlType;
last?: controlType;
prev?: controlType;
next?: controlType;
};
/**
* Props for the Pagination component.
*
*/
export interface PaginationProps extends React.HTMLAttributes<HTMLUListElement> {
/**
* The total number of pages.
*
* @default 0
*/
totalPage: number;
/**
* The current active page.
*
* @default undefined
*/
page: number;
/**
* Whether the pagination component should have a border.
*
* @default false
*/
bordered?: boolean;
/**
* If true, only navigation controls are shown, without page numbers.
*
* @default false
*/
onlyControl?: boolean;
/**
* Configuration for the pagination controls (first, previous, next, last).
*
* @default undefined
* @see controlConfigType
*/
controlConfig?: controlConfigType;
/**
* Defines the color theme of the pagination component.
*
* @default "neutral"
*/
color?: 'neutral' | 'accent';
/**
* The number of sibling page numbers to display around the current page.
*
* @default 0
*/
siblings?: 0 | 1 | 2 | 3;
/**
* Callback function triggered when the page changes.
*
* @param {number} page - The new page number.
*/
onPageChange?: (page: number) => void;
/**
* The type of component used for page links.
*
* @default "button"
*/
component?: 'button' | 'a' | React.ComponentType;
/**
* Additional props to pass to the component (pagination item).
*
* @default undefined
*/
componentProps?: Record<string, any>;
/**
* Function to generate the URL for a given page.
*
* @param {number} page - The page number.
* @returns {string} The URL for the given page.
*/
to?: (page: number) => string;
}
/**
* **Parity Pagination**.
*
* @see {@link https://beta-parity-react.vercel.app/pagination Parity Pagination}
*/
export declare const Pagination: React.ForwardRefExoticComponent<PaginationProps & React.RefAttributes<HTMLUListElement>>;
export interface PaginationItemProps extends React.HTMLAttributes<HTMLElement>, Pick<PaginationProps, 'component'> {
page: number;
active?: boolean;
isMenuItem?: boolean;
}
export declare const PaginationItem: React.ForwardRefExoticComponent<PaginationItemProps & React.RefAttributes<HTMLElement>>;
export interface ControlButtonProps extends React.HTMLAttributes<HTMLElement>, Pick<PaginationProps, 'component'> {
disabled?: boolean;
}
export declare const ControlButton: React.ForwardRefExoticComponent<ControlButtonProps & React.RefAttributes<HTMLElement>>;
type renderProps = {
items: number[];
currentPage: number;
handlePageChange: (page: number) => void;
component: 'button' | 'a' | React.ComponentType;
bordered: boolean;
componentProps?: any;
generateHref?: (page: number) => string;
pageRefs: React.MutableRefObject<(HTMLElement | null)[]>;
flag?: string;
isMenu?: boolean;
};
export declare const RenderItem: React.ForwardRefExoticComponent<renderProps & React.RefAttributes<HTMLElement>>;
export interface PaginationMenuProps extends React.HTMLAttributes<HTMLButtonElement>, renderProps {
menuProps?: Omit<MenuProps, 'children'>;
}
export declare const PaginationMenu: React.ForwardRefExoticComponent<PaginationMenuProps & React.RefAttributes<HTMLButtonElement>>;
export {};
//# sourceMappingURL=index.d.ts.map