lucid-ui
Version:
A UI component library from Xandr.
90 lines • 3.24 kB
TypeScript
import React, { FC } from 'react';
import { StandardProps } from '../../util/component-types';
import { ISingleSelectOptionProps, ISingleSelectProps, ISingleSelectState } from '../SingleSelect/SingleSelect';
import { ITextFieldProps } from '../TextField/TextField';
import { IButtonProps } from '../Button/Button';
declare type IPaginatorSingleSelectProps = Partial<ISingleSelectProps>;
declare type ShowTotalObjects = (count: number) => string;
export interface IPaginatorProps extends StandardProps, React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement> {
/**
* Appended to the component-specific class names set on the root elements.
*/
className?: string;
/**
* Whether or not to show the page size selector.
*/
hasPageSizeSelector?: boolean;
/**
* Disables the Paginator from being clicked or focused.
*/
isDisabled?: boolean;
/**
* Label when showTotalObjects is true with 1 or fewer objects.
*/
objectLabel?: string;
/**
* Label when showTotalObjects is true with more than 1 objects.
*/
objectLabelPlural?: string;
/**
* Called when a page is selected.
*/
onPageSelect?: (pageIndex: number, totalPages: number, { props, event, }: {
props: IButtonProps | ITextFieldProps;
event: React.MouseEvent | React.FormEvent | React.FocusEvent;
}) => void;
/**
* Called when a page size is selected.
*/
onPageSizeSelect?: (pageSizeIndex: number | null, { props, event, }: {
props: ISingleSelectOptionProps | undefined;
event: React.MouseEvent | React.KeyboardEvent;
}) => void;
/**
* 0-indexed currently selected page number.
*/
selectedPageIndex?: number;
/**
* Currently selected page size option index.
*/
selectedPageSizeIndex?: number;
/**
* Show total count of objects.
*/
showTotalObjects?: boolean | ShowTotalObjects;
/**
* Number to display in \`of \${totalPages}\`, calculated from
* \`totalPages\` and selected page size by default.
*/
totalPages?: number;
/**
* Total number of items across all pages.
*/
totalCount?: number | null;
/**
* Array of numbers representing page size options.
*/
pageSizeOptions?: number[];
/**
* Object of SingleSelect props which are passed thru to the underlying SingleSelect component for the page size selector.
*/
SingleSelect?: IPaginatorSingleSelectProps;
/**
* Object of TextField props which are passed thru to the underlying TextField component.
*/
TextField?: ITextFieldProps;
}
export interface IPaginatorState {
pageIndex: number;
totalPages: number;
totalCount: number;
selectedPageIndex: number;
selectedPageSizeIndex: number;
pageSizeOptions: number[];
SingleSelect: ISingleSelectState;
}
declare const Paginator: FC<IPaginatorProps> & ILucidComponent;
declare const _default: React.FC<IPaginatorProps> & ILucidComponent & import("../../util/state-management").IHybridComponent<IPaginatorProps, IPaginatorState>;
export default _default;
export { Paginator as PaginatorDumb };
//# sourceMappingURL=Paginator.d.ts.map