UNPKG

4.19 kBTypeScriptView Raw
1import * as React from 'react';
2import { OverridableStringUnion } from '@mui/types';
3import { SxProps } from '@mui/system';
4import { OverridableComponent, OverrideProps } from '@mui/material/OverridableComponent';
5import { Theme } from '../styles';
6import { UsePaginationItem } from '../usePagination/usePagination';
7import { PaginationItemClasses } from './paginationItemClasses';
8import { CreateSlotsAndSlotProps, SlotProps } from '../utils/types';
9
10export interface PaginationItemPropsVariantOverrides {}
11
12export interface PaginationItemPropsSizeOverrides {}
13
14export interface PaginationItemPropsColorOverrides {}
15
16export interface PaginationItemSlots {
17 first: React.ElementType;
18 last: React.ElementType;
19 next: React.ElementType;
20 previous: React.ElementType;
21}
22
23export type PaginationItemSlotsAndSlotProps = CreateSlotsAndSlotProps<
24 PaginationItemSlots,
25 {
26 first: SlotProps<React.ElementType<React.HTMLProps<HTMLElement>>, {}, PaginationItemOwnerState>;
27 last: SlotProps<React.ElementType<React.HTMLProps<HTMLElement>>, {}, PaginationItemOwnerState>;
28 next: SlotProps<React.ElementType<React.HTMLProps<HTMLElement>>, {}, PaginationItemOwnerState>;
29 previous: SlotProps<
30 React.ElementType<React.HTMLProps<HTMLElement>>,
31 {},
32 PaginationItemOwnerState
33 >;
34 }
35>;
36
37export interface PaginationItemOwnerState extends PaginationItemProps {}
38
39export interface PaginationItemOwnProps extends PaginationItemSlotsAndSlotProps {
40 /**
41 * Override or extend the styles applied to the component.
42 */
43 classes?: Partial<PaginationItemClasses>;
44 /**
45 * The active color.
46 * It supports both default and custom theme colors, which can be added as shown in the
47 * [palette customization guide](https://mui.com/material-ui/customization/palette/#custom-colors).
48 * @default 'standard'
49 */
50 color?: OverridableStringUnion<
51 'standard' | 'primary' | 'secondary',
52 PaginationItemPropsColorOverrides
53 >;
54 /**
55 * The components used for each slot inside.
56 *
57 * This prop is an alias for the `slots` prop.
58 * It's recommended to use the `slots` prop instead.
59 *
60 * @default {}
61 * @deprecated use the `slots` prop instead. This prop will be removed in v7. See [Migrating from deprecated APIs](https://mui.com/material-ui/migration/migrating-from-deprecated-apis/) for more details.
62 */
63 components?: {
64 first?: React.ElementType;
65 last?: React.ElementType;
66 next?: React.ElementType;
67 previous?: React.ElementType;
68 };
69 /**
70 * If `true`, the component is disabled.
71 * @default false
72 */
73 disabled?: boolean;
74 /**
75 * The current page number.
76 */
77 page?: React.ReactNode;
78 /**
79 * If `true` the pagination item is selected.
80 * @default false
81 */
82 selected?: boolean;
83 /**
84 * The shape of the pagination item.
85 * @default 'circular'
86 */
87 shape?: 'circular' | 'rounded';
88 /**
89 * The size of the component.
90 * @default 'medium'
91 */
92 size?: OverridableStringUnion<'small' | 'medium' | 'large', PaginationItemPropsSizeOverrides>;
93 /**
94 * The system prop that allows defining system overrides as well as additional CSS styles.
95 */
96 sx?: SxProps<Theme>;
97 /**
98 * The type of pagination item.
99 * @default 'page'
100 */
101 type?: UsePaginationItem['type'];
102 /**
103 * The variant to use.
104 * @default 'text'
105 */
106 variant?: OverridableStringUnion<'text' | 'outlined', PaginationItemPropsVariantOverrides>;
107}
108
109export interface PaginationItemTypeMap<
110 AdditionalProps = {},
111 RootComponent extends React.ElementType = 'div',
112> {
113 props: AdditionalProps & PaginationItemOwnProps;
114 defaultComponent: RootComponent;
115}
116
117/**
118 *
119 * Demos:
120 *
121 * - [Pagination](https://mui.com/material-ui/react-pagination/)
122 *
123 * API:
124 *
125 * - [PaginationItem API](https://mui.com/material-ui/api/pagination-item/)
126 */
127declare const PaginationItem: OverridableComponent<PaginationItemTypeMap>;
128
129export type PaginationItemProps<
130 RootComponent extends React.ElementType = PaginationItemTypeMap['defaultComponent'],
131 AdditionalProps = {},
132> = OverrideProps<PaginationItemTypeMap<AdditionalProps, RootComponent>, RootComponent> & {
133 component?: React.ElementType;
134};
135
136export default PaginationItem;