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
/**
@@ -123,7 +129,7 @@ export interface TablePaginationOwnProps extends TablePaginationBaseProps {
123
129
*
124
130
* @default {}
125
131
*/
126
- SelectProps ?: Partial < SelectProps > ;
132
+ SelectProps ?: SelectPropsVariant ;
127
133
/**
128
134
* If `true`, show the first-page button.
129
135
* @default false
@@ -147,19 +153,25 @@ export interface TablePaginationOwnProps extends TablePaginationBaseProps {
147
153
*/
148
154
sx ?: SxProps < Theme > ;
149
155
}
150
- type SelectVariant = 'filled' | 'standard' | 'outlined' ;
151
156
152
- /**
153
- export type SelectPropsByVariant<Variant extends SelectVariant = SelectVariant> =
154
- Variant extends 'filled'
155
- ? TablePaginationOwnProps
156
- : Variant extends 'standard'
157
- ? TablePaginationOwnProps
158
- : TablePaginationOwnProps;
159
- **/
157
+ type TablePaginationVariants = 'filled' | 'standard' | 'outlined' ;
158
+
159
+ type SelectInputProps < Variant extends TablePaginationVariants > = Variant extends 'filled'
160
+ ? Partial < FilledInputProps >
161
+ : Variant extends 'standard'
162
+ ? Partial < StandardInputProps >
163
+ : Partial < OutlinedInputProps > ;
164
+
165
+ export interface SelectPropsVariant <
166
+ Variant extends TablePaginationVariants = TablePaginationVariants ,
167
+ > extends Partial < SelectProps > {
168
+ variant ?: Variant ;
169
+ InputProps ?: SelectInputProps < Variant > ;
170
+ // ... (other variant-specific props)
171
+ }
160
172
161
173
export interface TablePaginationTypeMap < AdditionalProps , RootComponent extends React . ElementType > {
162
- props : AdditionalProps & { SelectProps : { variant : SelectVariant } } ;
174
+ props : AdditionalProps & TablePaginationOwnProps ;
163
175
defaultComponent : RootComponent ;
164
176
}
165
177
@@ -177,21 +189,15 @@ export interface TablePaginationTypeMap<AdditionalProps, RootComponent extends R
177
189
* - inherits [TableCell API](https://mui.com/material-ui/api/table-cell/)
178
190
*/
179
191
180
- declare const TablePagination : <
181
- AdditionalProps = { } ,
182
- RootComponent extends React . ElementType = React . JSXElementConstructor < TablePaginationBaseProps > ,
183
- Variant extends SelectVariant = SelectVariant
184
- > (
185
- props : TablePaginationProps < AdditionalProps , RootComponent , Variant > & { variant ?: Variant }
186
- ) => JSX . Element ;
192
+ declare const TablePagination : OverridableComponent <
193
+ TablePaginationTypeMap < { } , React . JSXElementConstructor < TablePaginationBaseProps > >
194
+ > ;
187
195
188
196
export type TablePaginationProps <
189
- AdditionalProps = { } ,
190
197
RootComponent extends React . ElementType = React . JSXElementConstructor < TablePaginationBaseProps > ,
191
- Variant extends SelectVariant = SelectVariant
198
+ AdditionalProps = { } ,
192
199
> = OverrideProps < TablePaginationTypeMap < AdditionalProps , RootComponent > , RootComponent > & {
193
200
component ?: React . ElementType ;
194
- variant ?: Variant ;
195
201
} ;
196
202
197
203
export default TablePagination ;
0 commit comments