material-ui - update to new dialog usage.

This commit is contained in:
Nathan Brown
2015-12-01 16:44:13 -07:00
parent 4910a7c52a
commit 9322940349
2 changed files with 30 additions and 6 deletions

View File

@@ -47,7 +47,13 @@ type CheckboxProps = __MaterialUI.CheckboxProps;
type MuiTheme = __MaterialUI.Styles.MuiTheme;
type TouchTapEvent = __MaterialUI.TouchTapEvent;
class MaterialUiTests extends React.Component<{}, {}> implements React.LinkedStateMixin {
interface MaterialUiTestsState {
showDialogStandardActions: boolean;
showDialogCustomActions: boolean;
showDialogScrollable: boolean;
}
class MaterialUiTests extends React.Component<{}, MaterialUiTestsState> implements React.LinkedStateMixin {
// injected with mixin
linkState: <T>(key: string) => React.ReactLink<T>;
@@ -60,6 +66,8 @@ class MaterialUiTests extends React.Component<{}, {}> implements React.LinkedSta
}
private selectFieldChangeHandler(e: TouchTapEvent, si: number, mi: any) {
}
private handleRequestClose(buttonClicked: boolean) {
}
render() {
@@ -193,7 +201,8 @@ class MaterialUiTests extends React.Component<{}, {}> implements React.LinkedSta
title="Dialog With Standard Actions"
actions={standardActions}
actionFocus="submit"
modal={true}>
open={this.state.showDialogStandardActions}
onRequestClose={this.handleRequestClose}>
The actions in this window are created from the json that's passed in.
</Dialog>;
@@ -212,12 +221,23 @@ class MaterialUiTests extends React.Component<{}, {}> implements React.LinkedSta
element = <Dialog
title="Dialog With Custom Actions"
actions={customActions}
modal={false}
autoDetectWindowHeight={true}
autoScrollBodyContent={true}>
open={this.state.showDialogCustomActions}
onRequestClose={this.handleRequestClose}>
The actions in this window were passed in as an array of react objects.
</Dialog>;
element = <Dialog
title="Dialog With Scrollable Content"
actions={customActions}
autoDetectWindowHeight={true}
autoScrollBodyContent={true}
open={this.state.showDialogScrollable}
onRequestClose={this.handleRequestClose}>
<div style={{ height: '1000px' }}>
Really long content
</div>
</Dialog>;
// "http://material-ui.com/#/components/dropdown-menu"
let menuItems = [

View File

@@ -1,4 +1,4 @@
// Type definitions for material-ui v0.13.1
// Type definitions for material-ui v0.13.4
// Project: https://github.com/callemall/material-ui
// Definitions by: Nathan Brown <https://github.com/ngbrown>, Oliver Herrmann <https://github.com/herrmanno>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
@@ -379,14 +379,18 @@ declare namespace __MaterialUI {
openImmediately?: boolean;
repositionOnUpdate?: boolean;
title?: React.ReactNode;
defaultOpen?: boolean;
open?: boolean;
onClickAway?: () => void;
onDismiss?: () => void;
onShow?: () => void;
onRequestClose?: (buttonClicked: boolean) => void;
}
export class Dialog extends React.Component<DialogProps, {}> {
dismiss(): void;
show(): void;
isOpen(): boolean;
}
interface DropDownIconProps extends React.Props<DropDownIcon> {