UNPKG

4.56 kBTypeScriptView Raw
1import * as React from 'react';
2import { PolymorphicProps, SlotComponentProps } from '../utils';
3export interface TablePaginationActionsRootSlotPropsOverrides {
4}
5export interface TablePaginationActionsFirstButtonSlotPropsOverrides {
6}
7export interface TablePaginationActionsLastButtonSlotPropsOverrides {
8}
9export interface TablePaginationActionsNextButtonSlotPropsOverrides {
10}
11export interface TablePaginationActionsBackButtonSlotPropsOverrides {
12}
13export interface TablePaginationActionsOwnProps {
14 count: number;
15 /**
16 * The components used for each slot inside the TablePagination.
17 * Either a string to use a HTML element or a component.
18 * @default {}
19 */
20 slots?: TablePaginationActionsSlots;
21 /**
22 * The props used for each slot inside the TablePagination.
23 * @default {}
24 */
25 slotProps?: {
26 root?: SlotComponentProps<'div', TablePaginationActionsRootSlotPropsOverrides, TablePaginationActionsOwnerState>;
27 firstButton?: SlotComponentProps<'button', TablePaginationActionsFirstButtonSlotPropsOverrides, TablePaginationActionsOwnerState>;
28 lastButton?: SlotComponentProps<'button', TablePaginationActionsLastButtonSlotPropsOverrides, TablePaginationActionsOwnerState>;
29 nextButton?: SlotComponentProps<'button', TablePaginationActionsNextButtonSlotPropsOverrides, TablePaginationActionsOwnerState>;
30 backButton?: SlotComponentProps<'button', TablePaginationActionsBackButtonSlotPropsOverrides, TablePaginationActionsOwnerState>;
31 };
32 /**
33 * Direction of the text.
34 * @default 'ltr'
35 */
36 direction?: 'ltr' | 'rtl';
37 /**
38 * Accepts a function which returns a string value that provides a user-friendly name for the current page.
39 * This is important for screen reader users.
40 *
41 * For localization purposes, you can use the provided [translations](/material-ui/guides/localization/).
42 * @param {string} type The link or button type to format ('first' | 'last' | 'next' | 'previous').
43 * @returns {string}
44 */
45 getItemAriaLabel: (type: 'first' | 'last' | 'next' | 'previous', page: number) => string;
46 onPageChange: (event: React.MouseEvent<HTMLButtonElement> | null, page: number) => void;
47 page: number;
48 rowsPerPage: number;
49 showFirstButton: boolean;
50 showLastButton: boolean;
51}
52export interface TablePaginationActionsSlots {
53 /**
54 * The component that renders the root.
55 * @default 'div'
56 */
57 root?: React.ElementType;
58 /**
59 * The component that renders the first button.
60 * @default 'button'
61 */
62 firstButton?: React.ElementType;
63 /**
64 * The component that renders the last button.
65 * @default 'button'
66 */
67 lastButton?: React.ElementType;
68 /**
69 * The component that renders the next button.
70 * @default 'button'
71 */
72 nextButton?: React.ElementType;
73 /**
74 * The component that renders the back button.
75 * @default 'button'
76 */
77 backButton?: React.ElementType;
78 /**
79 * The component that renders the first page icon.
80 * @default FirstPageIconDefault
81 */
82 firstPageIcon?: React.ElementType;
83 /**
84 * The component that renders the last page icon.
85 * @default LastPageIconDefault
86 */
87 lastPageIcon?: React.ElementType;
88 /**
89 * The component that renders the next page icon.
90 * @default NextPageIconDefault
91 */
92 nextPageIcon?: React.ElementType;
93 /**
94 * The component that renders the back page icon.
95 * @default BackPageIconDefault
96 */
97 backPageIcon?: React.ElementType;
98}
99export type TablePaginationActionsProps<RootComponentType extends React.ElementType = TablePaginationActionsTypeMap['defaultComponent']> = PolymorphicProps<TablePaginationActionsTypeMap<{}, RootComponentType>, RootComponentType>;
100export interface TablePaginationActionsTypeMap<AdditionalProps = {}, RootComponentType extends React.ElementType = 'button'> {
101 props: TablePaginationActionsOwnProps & AdditionalProps;
102 defaultComponent: RootComponentType;
103}
104export type TablePaginationActionsOwnerState = TablePaginationActionsOwnProps;
105export type TablePaginationActionsRootSlotProps = {
106 children?: React.ReactNode;
107 ownerState: TablePaginationActionsOwnerState;
108 ref: React.Ref<any>;
109};
110export type TablePaginationActionsButtonSlotProps = {
111 'aria-label': string;
112 children?: React.ReactNode;
113 disabled: boolean;
114 onClick: React.MouseEventHandler<HTMLButtonElement>;
115 ownerState: TablePaginationActionsOwnerState;
116 title: string;
117};