| 1 |
/// <reference types="react" /> |
| 2 |
import { PaginationToggleTemplateProps } from './ToggleTemplate'; |
| 3 |
import { OUIAProps } from '../../helpers'; |
| 4 |
export declare enum PaginationVariant { |
| 5 |
bottom = "bottom", |
| 6 |
top = "top" |
| 7 |
} |
| 8 |
/** Properties to customize the content and behavior of the pagination dropdown options. These |
| 9 |
* properties should be passed into the pagination component's perPageOptions property. |
| 10 |
*/ |
| 11 |
export interface PerPageOptions { |
| 12 |
/** The text title of the option, which is rendered inside the pagination dropdown menu. */ |
| 13 |
title?: string; |
| 14 |
/** The value of the option, which determines how many items are displayed per page. */ |
| 15 |
value?: number; |
| 16 |
} |
| 17 |
/** Properties to customize various pagination titles. The following properties should be |
| 18 |
* passed into the pagination component's title property. |
| 19 |
*/ |
| 20 |
export interface PaginationTitles { |
| 21 |
/** Accessible label for the input displaying the current page. */ |
| 22 |
currPageAriaLabel?: string; |
| 23 |
/** The type or title of the items being paginated. */ |
| 24 |
items?: string; |
| 25 |
/** The title of the pagination options menu. */ |
| 26 |
itemsPerPage?: string; |
| 27 |
/** Label for the English word "of". */ |
| 28 |
ofWord?: string; |
| 29 |
/** Accessible label for the options toggle. */ |
| 30 |
optionsToggleAriaLabel?: string; |
| 31 |
/** The title of a page displayed beside the page number. */ |
| 32 |
page?: string; |
| 33 |
/** The title of a page displayed beside the page number (plural form). */ |
| 34 |
pages?: string; |
| 35 |
/** Accessible label for the pagination component. */ |
| 36 |
paginationAriaLabel?: string; |
| 37 |
/** The suffix to be displayed after each option on the options menu dropdown. */ |
| 38 |
perPageSuffix?: string; |
| 39 |
/** Accessible label for the button which moves to the first page. */ |
| 40 |
toFirstPageAriaLabel?: string; |
| 41 |
/** Accessible label for the button which moves to the last page. */ |
| 42 |
toLastPageAriaLabel?: string; |
| 43 |
/** Accessible label for the button which moves to the next page. */ |
| 44 |
toNextPageAriaLabel?: string; |
| 45 |
/** Accessible label for the button which moves to the previous page. */ |
| 46 |
toPreviousPageAriaLabel?: string; |
| 47 |
} |
| 48 |
export type OnSetPage = (event: React.MouseEvent | React.KeyboardEvent | MouseEvent, newPage: number, perPage?: number, startIdx?: number, endIdx?: number) => void; |
| 49 |
export type OnPerPageSelect = (event: React.MouseEvent | React.KeyboardEvent | MouseEvent, newPerPage: number, newPage: number, startIdx?: number, endIdx?: number) => void; |
| 50 |
/** The main pagination component. */ |
| 51 |
export interface PaginationProps extends React.HTMLProps<HTMLDivElement>, OUIAProps { |
| 52 |
/** What should be rendered inside the pagination. */ |
| 53 |
children?: React.ReactNode; |
| 54 |
/** Additional classes for the pagination container. */ |
| 55 |
className?: string; |
| 56 |
/** Indicate whether to show last full page of results when user selects perPage value |
| 57 |
* greater than remaining rows. |
| 58 |
*/ |
| 59 |
isLastFullPageShown?: boolean; |
| 60 |
/** Direction of dropdown context menu. */ |
| 61 |
dropDirection?: 'up' | 'down'; |
| 62 |
/** Page to start at. */ |
| 63 |
firstPage?: number; |
| 64 |
/** Flag indicating that pagination should use page insets. */ |
| 65 |
usePageInsets?: boolean; |
| 66 |
/** Insets at various breakpoints. */ |
| 67 |
inset?: { |
| 68 |
default?: 'insetNone' | 'insetSm' | 'insetMd' | 'insetLg' | 'insetXl' | 'inset2xl'; |
| 69 |
sm?: 'insetNone' | 'insetSm' | 'insetMd' | 'insetLg' | 'insetXl' | 'inset2xl'; |
| 70 |
md?: 'insetNone' | 'insetSm' | 'insetMd' | 'insetLg' | 'insetXl' | 'inset2xl'; |
| 71 |
lg?: 'insetNone' | 'insetSm' | 'insetMd' | 'insetLg' | 'insetXl' | 'inset2xl'; |
| 72 |
xl?: 'insetNone' | 'insetSm' | 'insetMd' | 'insetLg' | 'insetXl' | 'inset2xl'; |
| 73 |
'2xl'?: 'insetNone' | 'insetSm' | 'insetMd' | 'insetLg' | 'insetXl' | 'inset2xl'; |
| 74 |
}; |
| 75 |
/** Flag indicating if pagination is disabled. */ |
| 76 |
isDisabled?: boolean; |
| 77 |
/** Flag indicating if pagination is compact. */ |
| 78 |
isCompact?: boolean; |
| 79 |
/** Flag indicating if pagination should not be sticky on mobile. */ |
| 80 |
isStatic?: boolean; |
| 81 |
/** Flag indicating if pagination should stick to its position (based on variant). For dynamic sticky control, use isStickyBase |
| 82 |
* and isStickyStuck instead. |
| 83 |
*/ |
| 84 |
isSticky?: boolean; |
| 85 |
/** @beta Flag indicating the pagination should have sticky positioning relative to its container. */ |
| 86 |
isStickyBase?: boolean; |
| 87 |
/** @beta Flag indicating the pagination should have stuck styling, when the pagination is not at the top (for top variant) or bottom (for bottom variant) of the scroll container. */ |
| 88 |
isStickyStuck?: boolean; |
| 89 |
/** Total number of items. */ |
| 90 |
itemCount?: number; |
| 91 |
/** Last index of items on current page. */ |
| 92 |
itemsEnd?: number; |
| 93 |
/** First index of items on current page. */ |
| 94 |
itemsStart?: number; |
| 95 |
/** Start index of rows to display, used in place of providing page. */ |
| 96 |
offset?: number; |
| 97 |
/** Current page number. */ |
| 98 |
page?: number; |
| 99 |
/** Number of items per page. */ |
| 100 |
perPage?: number; |
| 101 |
/** Array of the number of items per page options. */ |
| 102 |
perPageOptions?: PerPageOptions[]; |
| 103 |
/** Function called when user clicks on navigate to first page. */ |
| 104 |
onFirstClick?: (event: React.SyntheticEvent<HTMLButtonElement>, page: number) => void; |
| 105 |
/** Function called when user clicks on navigate to last page. */ |
| 106 |
onLastClick?: (event: React.SyntheticEvent<HTMLButtonElement>, page: number) => void; |
| 107 |
/** Function called when user clicks on navigate to next page. */ |
| 108 |
onNextClick?: (event: React.SyntheticEvent<HTMLButtonElement>, page: number) => void; |
| 109 |
/** Function called when user inputs page number. */ |
| 110 |
onPageInput?: (event: React.KeyboardEvent<HTMLInputElement>, page: number) => void; |
| 111 |
/** Function called when user selects number of items per page. */ |
| 112 |
onPerPageSelect?: OnPerPageSelect; |
| 113 |
/** Function called when user clicks on navigate to previous page. */ |
| 114 |
onPreviousClick?: (event: React.SyntheticEvent<HTMLButtonElement>, page: number) => void; |
| 115 |
/** Function called when user sets page. */ |
| 116 |
onSetPage?: OnSetPage; |
| 117 |
/** Object with titles to display in pagination. */ |
| 118 |
titles?: PaginationTitles; |
| 119 |
/** This will be shown in pagination toggle span. You can use firstIndex, lastIndex, |
| 120 |
* itemCount, itemsTitle, and/or ofWord props. |
| 121 |
*/ |
| 122 |
toggleTemplate?: ((props: PaginationToggleTemplateProps) => React.ReactElement<any>) | string; |
| 123 |
/** Position where pagination is rendered. */ |
| 124 |
variant?: 'top' | 'bottom' | PaginationVariant; |
| 125 |
/** Id to identify widget on page. */ |
| 126 |
widgetId?: string; |
| 127 |
/** Value to overwrite the randomly generated data-ouia-component-id.*/ |
| 128 |
ouiaId?: number | string; |
| 129 |
/** Set the value of data-ouia-safe. Only set to true when the component is in a static state, i.e. no animations are occurring. At all other times, this value must be false. */ |
| 130 |
ouiaSafe?: boolean; |
| 131 |
/** @beta The container to append the pagination options menu to. */ |
| 132 |
menuAppendTo?: HTMLElement | (() => HTMLElement) | 'inline'; |
| 133 |
} |
| 134 |
export declare const Pagination: React.FunctionComponent<PaginationProps>; |
| 135 |
//# sourceMappingURL=Pagination.d.ts.map |