forked from mui/material-ui
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[core] Update type defs to use OverridableComponent (mui#20110)
- Loading branch information
1 parent
36b461d
commit 592f0b5
Showing
19 changed files
with
377 additions
and
269 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
59 changes: 30 additions & 29 deletions
59
packages/material-ui/src/BottomNavigation/BottomNavigation.d.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,36 @@ | ||
import * as React from 'react'; | ||
import { StandardProps } from '..'; | ||
import { OverridableComponent, OverrideProps } from '../OverridableComponent'; | ||
|
||
export interface BottomNavigationProps | ||
extends StandardProps< | ||
React.HTMLAttributes<HTMLDivElement>, | ||
BottomNavigationClassKey, | ||
'onChange' | ||
> { | ||
/** | ||
* The component used for the root node. | ||
* Either a string to use a DOM element or a component. | ||
*/ | ||
component?: React.ElementType<React.HTMLAttributes<HTMLDivElement>>; | ||
/** | ||
* Callback fired when the value changes. | ||
* | ||
* @param {object} event The event source of the callback. | ||
* @param {any} value We default to the index of the child. | ||
*/ | ||
onChange?(event: React.ChangeEvent<{}>, value: any): void; | ||
/** | ||
* If `true`, all `BottomNavigationAction`s will show their labels. | ||
* By default, only the selected `BottomNavigationAction` will show its label. | ||
*/ | ||
showLabels?: boolean; | ||
/** | ||
* The value of the currently selected `BottomNavigationAction`. | ||
*/ | ||
value?: any; | ||
export interface BottomNavigationTypeMap<P = {}, D extends React.ElementType = 'div'> { | ||
props: P & { | ||
/** | ||
* Callback fired when the value changes. | ||
* | ||
* @param {object} event The event source of the callback. | ||
* @param {any} value We default to the index of the child. | ||
*/ | ||
onChange?: (event: React.ChangeEvent<{}>, value: any) => void; | ||
/** | ||
* If `true`, all `BottomNavigationAction`s will show their labels. | ||
* By default, only the selected `BottomNavigationAction` will show its label. | ||
*/ | ||
showLabels?: boolean; | ||
/** | ||
* The value of the currently selected `BottomNavigationAction`. | ||
*/ | ||
value?: any; | ||
}; | ||
defaultComponent: D; | ||
classKey: BottomNavigationClassKey; | ||
} | ||
|
||
declare const BottomNavigation: OverridableComponent<BottomNavigationTypeMap>; | ||
|
||
export type BottomNavigationClassKey = 'root'; | ||
|
||
export default function BottomNavigation(props: BottomNavigationProps): JSX.Element; | ||
export type BottomNavigationProps< | ||
D extends React.ElementType = BottomNavigationTypeMap['defaultComponent'], | ||
P = {} | ||
> = OverrideProps<BottomNavigationTypeMap<P, D>, D>; | ||
|
||
export default BottomNavigation; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,19 @@ | ||
import * as React from 'react'; | ||
import { StandardProps } from '..'; | ||
import { OverridableComponent, OverrideProps } from '../OverridableComponent'; | ||
|
||
export interface CardContentProps | ||
extends StandardProps<React.HTMLAttributes<HTMLDivElement>, CardContentClassKey> { | ||
component?: React.ElementType<React.HTMLAttributes<HTMLDivElement>>; | ||
export interface CardContentTypeMap<P = {}, D extends React.ElementType = 'div'> { | ||
props: P; | ||
defaultComponent: D; | ||
classKey: CardContentClassKey; | ||
} | ||
|
||
declare const CardContent: OverridableComponent<CardContentTypeMap>; | ||
|
||
export type CardContentClassKey = 'root'; | ||
|
||
declare const CardContent: React.ComponentType<CardContentProps>; | ||
export type CardContentProps< | ||
D extends React.ElementType = CardContentTypeMap['defaultComponent'], | ||
P = {} | ||
> = OverrideProps<CardContentTypeMap<P, D>, D>; | ||
|
||
export default CardContent; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,28 @@ | ||
import * as React from 'react'; | ||
import { StandardProps } from '..'; | ||
import { TypographyProps } from '../Typography'; | ||
import { OverridableComponent, OverrideProps } from '../OverridableComponent'; | ||
|
||
export interface CardHeaderProps | ||
extends StandardProps<React.HTMLAttributes<HTMLDivElement>, CardHeaderClassKey, 'title'> { | ||
action?: React.ReactNode; | ||
avatar?: React.ReactNode; | ||
component?: React.ElementType<React.HTMLAttributes<HTMLDivElement>>; | ||
disableTypography?: boolean; | ||
subheader?: React.ReactNode; | ||
subheaderTypographyProps?: Partial<TypographyProps>; | ||
title?: React.ReactNode; | ||
titleTypographyProps?: Partial<TypographyProps>; | ||
export interface CardHeaderTypeMap<P = {}, D extends React.ElementType = 'div'> { | ||
props: P & { | ||
action?: React.ReactNode; | ||
avatar?: React.ReactNode; | ||
disableTypography?: boolean; | ||
subheader?: React.ReactNode; | ||
subheaderTypographyProps?: Partial<TypographyProps>; | ||
title?: React.ReactNode; | ||
titleTypographyProps?: Partial<TypographyProps>; | ||
}; | ||
defaultComponent: D; | ||
classKey: CardHeaderClassKey; | ||
} | ||
|
||
declare const CardHeader: OverridableComponent<CardHeaderTypeMap>; | ||
|
||
export type CardHeaderClassKey = 'root' | 'avatar' | 'action' | 'content' | 'title' | 'subheader'; | ||
|
||
declare const CardHeader: React.ComponentType<CardHeaderProps>; | ||
export type CardHeaderProps< | ||
D extends React.ElementType = CardHeaderTypeMap['defaultComponent'], | ||
P = {} | ||
> = OverrideProps<CardHeaderTypeMap<P, D>, D>; | ||
|
||
export default CardHeader; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,23 @@ | ||
import * as React from 'react'; | ||
import { StandardProps } from '..'; | ||
import { OverridableComponent, OverrideProps } from '../OverridableComponent'; | ||
|
||
export interface GridListProps | ||
extends StandardProps<React.HTMLAttributes<HTMLUListElement>, GridListClassKey> { | ||
cellHeight?: number | 'auto'; | ||
cols?: number; | ||
component?: React.ElementType<React.HTMLAttributes<HTMLUListElement>>; | ||
spacing?: number; | ||
export interface GridListTypeMap<P = {}, D extends React.ElementType = 'ul'> { | ||
props: P & { | ||
cellHeight?: number | 'auto'; | ||
cols?: number; | ||
spacing?: number; | ||
}; | ||
defaultComponent: D; | ||
classKey: GridListClassKey; | ||
} | ||
|
||
declare const GridList: OverridableComponent<GridListTypeMap>; | ||
|
||
export type GridListClassKey = 'root'; | ||
|
||
declare const GridList: React.ComponentType<GridListProps>; | ||
export type GridListProps< | ||
D extends React.ElementType = GridListTypeMap['defaultComponent'], | ||
P = {} | ||
> = OverrideProps<GridListTypeMap<P, D>, D>; | ||
|
||
export default GridList; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,22 @@ | ||
import * as React from 'react'; | ||
import { StandardProps } from '..'; | ||
import { OverridableComponent, OverrideProps } from '../OverridableComponent'; | ||
|
||
export interface GridListTileProps | ||
extends StandardProps<React.HTMLAttributes<HTMLLIElement>, GridListTileClassKey> { | ||
cols?: number; | ||
component?: React.ElementType<React.HTMLAttributes<HTMLLIElement>>; | ||
rows?: number; | ||
export interface GridListTileTypeMap<P = {}, D extends React.ElementType = 'li'> { | ||
props: P & { | ||
cols?: number; | ||
rows?: number; | ||
}; | ||
defaultComponent: D; | ||
classKey: GridListTileClassKey; | ||
} | ||
|
||
declare const GridListTile: OverridableComponent<GridListTileTypeMap>; | ||
|
||
export type GridListTileClassKey = 'root' | 'tile' | 'imgFullHeight' | 'imgFullWidth'; | ||
|
||
declare const GridListTile: React.ComponentType<GridListTileProps>; | ||
export type GridListTileProps< | ||
D extends React.ElementType = GridListTileTypeMap['defaultComponent'], | ||
P = {} | ||
> = OverrideProps<GridListTileTypeMap<P, D>, D>; | ||
|
||
export default GridListTile; |
Oops, something went wrong.