1
1
import * as React from 'react' ;
2
2
import { SxProps } from '@mui/system' ;
3
+ import { FilledInputProps } from '@mui/material/FilledInput' ;
4
+ import { OutlinedInputProps } from '@mui/material/OutlinedInput' ;
5
+ import { InputProps as StandardInputProps } from '../Input' ;
3
6
import { Theme } from '../styles' ;
4
7
import { OverridableComponent , OverrideProps } from '../OverridableComponent' ;
5
8
import { TablePaginationActionsProps } from './TablePaginationActions' ;
@@ -18,7 +21,10 @@ export interface LabelDisplayedRowsArgs {
18
21
/**
19
22
* This type is kept for compatibility. Use `TablePaginationOwnProps` instead.
20
23
*/
21
- export type TablePaginationBaseProps = Omit < TableCellProps , 'classes' | 'component' | 'children' > ;
24
+ export type TablePaginationBaseProps = Omit <
25
+ TableCellProps ,
26
+ 'classes' | 'component' | 'children' | 'variant'
27
+ > ;
22
28
23
29
export interface TablePaginationOwnProps extends TablePaginationBaseProps {
24
30
/**
@@ -108,7 +114,7 @@ export interface TablePaginationOwnProps extends TablePaginationBaseProps {
108
114
* Props applied to the rows per page [`Select`](/material-ui/api/select/) element.
109
115
* @default {}
110
116
*/
111
- SelectProps ?: Partial < SelectProps > ;
117
+ SelectProps ?: SelectPropsVariant ;
112
118
/**
113
119
* If `true`, show the first-page button.
114
120
* @default false
@@ -124,19 +130,25 @@ export interface TablePaginationOwnProps extends TablePaginationBaseProps {
124
130
*/
125
131
sx ?: SxProps < Theme > ;
126
132
}
127
- type SelectVariant = 'filled' | 'standard' | 'outlined' ;
128
133
129
- /**
130
- export type SelectPropsByVariant<Variant extends SelectVariant = SelectVariant> =
131
- Variant extends 'filled'
132
- ? TablePaginationOwnProps
133
- : Variant extends 'standard'
134
- ? TablePaginationOwnProps
135
- : TablePaginationOwnProps;
136
- **/
134
+ type TablePaginationVariants = 'filled' | 'standard' | 'outlined' ;
135
+
136
+ type SelectInputProps < Variant extends TablePaginationVariants > = Variant extends 'filled'
137
+ ? Partial < FilledInputProps >
138
+ : Variant extends 'standard'
139
+ ? Partial < StandardInputProps >
140
+ : Partial < OutlinedInputProps > ;
141
+
142
+ export interface SelectPropsVariant <
143
+ Variant extends TablePaginationVariants = TablePaginationVariants ,
144
+ > extends Partial < SelectProps > {
145
+ variant ?: Variant ;
146
+ InputProps ?: SelectInputProps < Variant > ;
147
+ // ... (other variant-specific props)
148
+ }
137
149
138
150
export interface TablePaginationTypeMap < AdditionalProps , RootComponent extends React . ElementType > {
139
- props : AdditionalProps & { SelectProps : { variant : SelectVariant } } ;
151
+ props : AdditionalProps & TablePaginationOwnProps ;
140
152
defaultComponent : RootComponent ;
141
153
}
142
154
@@ -153,21 +165,15 @@ export interface TablePaginationTypeMap<AdditionalProps, RootComponent extends R
153
165
* - inherits [TableCell API](https://mui.com/material-ui/api/table-cell/)
154
166
*/
155
167
156
- declare const TablePagination : <
157
- AdditionalProps = { } ,
158
- RootComponent extends React . ElementType = React . JSXElementConstructor < TablePaginationBaseProps > ,
159
- Variant extends SelectVariant = SelectVariant
160
- > (
161
- props : TablePaginationProps < AdditionalProps , RootComponent , Variant > & { variant ?: Variant }
162
- ) => JSX . Element ;
168
+ declare const TablePagination : OverridableComponent <
169
+ TablePaginationTypeMap < { } , React . JSXElementConstructor < TablePaginationBaseProps > >
170
+ > ;
163
171
164
172
export type TablePaginationProps <
165
- AdditionalProps = { } ,
166
173
RootComponent extends React . ElementType = React . JSXElementConstructor < TablePaginationBaseProps > ,
167
- Variant extends SelectVariant = SelectVariant
174
+ AdditionalProps = { } ,
168
175
> = OverrideProps < TablePaginationTypeMap < AdditionalProps , RootComponent > , RootComponent > & {
169
176
component ?: React . ElementType ;
170
- variant ?: Variant ;
171
177
} ;
172
178
173
179
export default TablePagination ;
0 commit comments