diff --git a/types/material-ui/index.d.ts b/types/material-ui/index.d.ts index 8831696635..98a1e8d8ba 100644 --- a/types/material-ui/index.d.ts +++ b/types/material-ui/index.d.ts @@ -147,10 +147,6 @@ declare module "material-ui" { export import ToolbarSeparatorProps = __MaterialUI.Toolbar.ToolbarSeparatorProps; export import ToolbarTitle = __MaterialUI.Toolbar.ToolbarTitle; export import ToolbarTitleProps = __MaterialUI.Toolbar.ToolbarTitleProps; - - // export type definitions - export type TouchTapEvent = __MaterialUI.TouchTapEvent; - export type TouchTapEventHandler = __MaterialUI.TouchTapEventHandler; } declare namespace __MaterialUI { @@ -160,19 +156,6 @@ declare namespace __MaterialUI { requestChange(newValue: T): void; } - // What's common between React.TouchEvent and React.MouseEvent - interface TouchTapEvent extends React.SyntheticEvent<{}> { - altKey: boolean; - ctrlKey: boolean; - getModifierState(key: string): boolean; - metaKey: boolean; - shiftKey: boolean; - } - - // What's common between React.TouchEventHandler and React.MouseEventHandler - interface TouchTapEventHandler extends React.EventHandler { - } - export interface ThemeWrapperProps { theme: Styles.MuiTheme; } @@ -578,9 +561,9 @@ declare namespace __MaterialUI { iconElementRight?: React.ReactElement; iconStyleRight?: React.CSSProperties; iconStyleLeft?: React.CSSProperties; - onLeftIconButtonClick?: TouchTapEventHandler; - onRightIconButtonClick?: TouchTapEventHandler; - onTitleTouchTap?: TouchTapEventHandler; + onLeftIconButtonClick?: React.MouseEventHandler<{}>; + onRightIconButtonClick?: React.MouseEventHandler<{}>; + onTitleClick?: React.MouseEventHandler<{}>; showMenuIconButton?: boolean; style?: React.CSSProperties; title?: React.ReactNode; @@ -715,7 +698,6 @@ declare namespace __MaterialUI { onKeyboardFocus?(e: React.FocusEvent<{}>, isKeyboardFocused: boolean): void; onKeyDown?: React.KeyboardEventHandler<{}>; onKeyUp?: React.KeyboardEventHandler<{}>; - onTouchTap?: TouchTapEventHandler; onClick?: React.MouseEventHandler<{}>; style?: React.CSSProperties; tabIndex?: number; @@ -1048,7 +1030,6 @@ declare namespace __MaterialUI { export interface DialogAction { id?: string; onClick?: React.MouseEventHandler<{}>; - onTouchTap?: TouchTapEventHandler; ref?: string; text: string; } @@ -1129,7 +1110,7 @@ declare namespace __MaterialUI { titleBackground?: string; titlePosition?: "top" | "bottom"; titleStyle?: React.CSSProperties; - onTouchTap?: TouchTapEventHandler; + onClick?: React.MouseEventHandler<{}>; } export class GridTile extends React.Component { } @@ -1186,7 +1167,7 @@ declare namespace __MaterialUI { onMouseLeave?: React.MouseEventHandler<{}>; onNestedListToggle?(item: ListItem): void; onTouchStart?: React.TouchEventHandler<{}>; - onTouchTap?: TouchTapEventHandler; + onClick?: React.MouseEventHandler<{}>; open?: boolean; primaryText?: React.ReactNode; primaryTogglesNestedList?: boolean; @@ -1203,7 +1184,7 @@ declare namespace __MaterialUI { } export interface SelectableProps { - onChange?(e: TouchTapEvent, value: any): void; + onChange?(e: React.SyntheticEvent<{}>, value: any): void; selectedItemStyle?: React.CSSProperties; value?: any; } @@ -1222,9 +1203,9 @@ declare namespace __MaterialUI { listStyle?: React.CSSProperties; maxHeight?: number; multiple?: boolean; - onChange?(e: TouchTapEvent, itemValue: any | any[]): void; + onChange?(e: React.SyntheticEvent<{}>, itemValue: any | any[]): void; onEscKeyDown?: React.KeyboardEventHandler<{}>; - onItemTouchTap?(e: TouchTapEvent, item: MenuItem): void; + onItemTouchTap?(e: React.SyntheticEvent<{}>, item: MenuItem): void; onKeyDown?: React.KeyboardEventHandler<{}>; selectedMenuItemStyle?: React.CSSProperties; style?: React.CSSProperties; @@ -1247,7 +1228,7 @@ declare namespace __MaterialUI { label?: string | React.ReactNode; leftIcon?: React.ReactElement; menuItems?: React.ReactNode; - onTouchTap?: TouchTapEventHandler; + onClick?: React.MouseEventHandler<{}>; primaryText?: React.ReactNode; rightIcon?: React.ReactElement; secondaryText?: React.ReactNode; @@ -1265,14 +1246,14 @@ declare namespace __MaterialUI { iconButtonElement: React.ReactElement; iconStyle?: React.CSSProperties; menuStyle?: React.CSSProperties; - onItemTouchTap?(e: TouchTapEvent, item: MenuItem): void; + onItemTouchTap?(e: React.SyntheticEvent<{}>, item: MenuItem): void; onKeyboardFocus?(e: React.FocusEvent<{}>, isKeyboardFocused: boolean): void; onMouseDown?: React.MouseEventHandler<{}>; onMouseEnter?: React.MouseEventHandler<{}>; onMouseLeave?: React.MouseEventHandler<{}>; onMouseUp?: React.MouseEventHandler<{}>; onRequestChange?(opening: boolean, reason: string): void; - onTouchTap?: TouchTapEventHandler; + onClick?: React.MouseEventHandler<{}>; open?: boolean; style?: React.CSSProperties; targetOrigin?: propTypes.origin; @@ -1285,7 +1266,7 @@ declare namespace __MaterialUI { listStyle?: React.CSSProperties; maxHeight?: number; multiple?: boolean; - onChange?(e: TouchTapEvent, itemValue: any | any[]): void; + onChange?(e: React.SyntheticEvent<{}>, itemValue: any | any[]): void; onKeyDown?: React.KeyboardEventHandler<{}>; selectedMenuItemStyle?: React.CSSProperties; value?: any | any[]; @@ -1311,8 +1292,8 @@ declare namespace __MaterialUI { menuItemStyle?: React.CSSProperties; menuStyle?: React.CSSProperties; multiple?: boolean; - onChange?(e: TouchTapEvent, index: number, menuItemValue: any): void; - onClose?(e: TouchTapEvent): void; + onChange?(e: React.SyntheticEvent<{}>, index: number, menuItemValue: any): void; + onClose?(e: React.SyntheticEvent<{}>): void; openImmediately?: boolean; selectedMenuItemStyle?: React.CSSProperties; selectionRenderer?(value: any, menuItem: any): void; @@ -1330,7 +1311,6 @@ declare namespace __MaterialUI { show?: boolean; transitionEnabled?: boolean; onClick?: React.MouseEventHandler<{}>; - onTouchTap?: TouchTapEventHandler; } export class Overlay extends React.Component { } @@ -1444,7 +1424,7 @@ declare namespace __MaterialUI { labelStyle?: React.CSSProperties; multiple?: boolean; onBlur?: React.FocusEventHandler<{}>; - onChange?(e: TouchTapEvent, index: number, menuItemValue: any): void; + onChange?(e: React.SyntheticEvent<{}>, index: number, menuItemValue: any): void; onFocus?: React.FocusEventHandler<{}>; selectFieldRoot?: React.CSSProperties; selectionRenderer?(value: any): React.ReactNode; @@ -1957,7 +1937,7 @@ declare namespace __MaterialUI { onDismiss?(): void; onFocus?: React.FocusEventHandler<{}>; onShow?(): void; - onTouchTap?: TouchTapEventHandler; + onClick?: React.MouseEventHandler<{}>; pedantic?: boolean; style?: React.CSSProperties; textFieldStyle?: React.CSSProperties; @@ -9015,7 +8995,6 @@ declare module 'material-ui/internal/Overlay' { style?: React.CSSProperties; transitionEnabled?: boolean; onClick?: React.MouseEventHandler<{}>; - onTouchTap?: __MaterialUI.TouchTapEventHandler; } class Overlay extends React.Component { } export default Overlay; diff --git a/types/material-ui/material-ui-tests.tsx b/types/material-ui/material-ui-tests.tsx index 3187188e99..c47383573e 100644 --- a/types/material-ui/material-ui-tests.tsx +++ b/types/material-ui/material-ui-tests.tsx @@ -2344,7 +2344,7 @@ const AppBarExampleIcon = () => ( const AppBarExampleIconButton = () => ( Title} - onTitleTouchTap={handleTouchTap} + onTitleClick={handleTouchTap} iconElementLeft={} iconElementRight={} /> @@ -3014,8 +3014,8 @@ class CardExampleControlled extends Component<{}, {expanded: boolean}> { Aliquam dui mauris, mattis quis lacus id, pellentesque lobortis odio. - - + + ); @@ -3247,19 +3247,19 @@ class DialogExampleSimple extends Component<{}, {open?: boolean}> { , , ]; return (
- + { , , ]; return (
- + { , , ]; return (
- + { label="Ok" primary={true} keyboardFocused={true} - onTouchTap={this.handleClose} + onClick={this.handleClose} />, ]; return (
- + { , , ]; @@ -3445,7 +3445,7 @@ class DialogExampleScrollable extends Component<{}, {open?: boolean}> { return (
- + { , , ]; return (
- + {
Menu Item @@ -3583,7 +3583,7 @@ class DrawerUndockedExample extends Component<{}, {open?: boolean}> {
{ open={this.state.open} onRequestChange={(open) => this.setState({open})} > - Menu Item - Menu Item 2 + Menu Item + Menu Item 2
); @@ -3612,7 +3612,7 @@ class DrawerOpenRightExample extends Component<{}, {open?: boolean}> {
@@ -4567,7 +4567,7 @@ class IconMenuExampleControlled extends Component<{}, IconMenuExampleControlledS - +
); } @@ -4844,7 +4844,7 @@ class PopoverExampleSimple extends Component<{}, {open?: boolean, anchorEl?: Rea return (

Current Settings

@@ -5705,7 +5705,7 @@ class SnackbarExampleSimple extends Component<{}, {open?: boolean}> { return (

@@ -5820,7 +5820,7 @@ class SnackbarExampleTwice extends Component<{}, {open?: boolean, message?: stri return (
@@ -5955,7 +5955,7 @@ class VerticalLinearStepper extends Component<{}, {stepIndex?: number, finished? disableTouchRipple={true} disableFocusRipple={true} primary={true} - onTouchTap={this.handleNext} + onClick={this.handleNext} style={{marginRight: 12}} /> {step > 0 && ( @@ -5964,7 +5964,7 @@ class VerticalLinearStepper extends Component<{}, {stepIndex?: number, finished? disabled={stepIndex === 0} disableTouchRipple={true} disableFocusRipple={true} - onTouchTap={this.handlePrev} + onClick={this.handlePrev} /> )}
@@ -6087,14 +6087,14 @@ class HorizontalNonLinearStepper extends Component<{}, {stepIndex?: number}> {
@@ -6130,7 +6130,7 @@ class VerticalNonLinear extends Component<{}, {stepIndex?: number}> { disableTouchRipple={true} disableFocusRipple={true} primary={true} - onTouchTap={this.handleNext} + onClick={this.handleNext} style={{marginRight: 12}} /> {step > 0 && ( @@ -6138,7 +6138,7 @@ class VerticalNonLinear extends Component<{}, {stepIndex?: number}> { label="Back" disableTouchRipple={true} disableFocusRipple={true} - onTouchTap={this.handlePrev} + onClick={this.handlePrev} /> )}
@@ -6302,13 +6302,13 @@ class GranularControlStepper extends Component<{}, {stepIndex?: number, visited?
)} @@ -7011,8 +7011,8 @@ class BottomNavigationExample extends Component<{}, { } render() { return - } onTouchTap={() => this.setState({index: 0})}/> - } onTouchTap={() => this.setState({index: 1})}/> + } onClick={() => this.setState({index: 0})}/> + } onClick={() => this.setState({index: 1})}/> ; } }