diff --git a/.babelrc b/.babelrc
new file mode 100644
index 00000000000000..9e50396b4fbd2c
--- /dev/null
+++ b/.babelrc
@@ -0,0 +1,6 @@
+{
+ "stage": 1,
+ "plugins": [
+ "dev-expression"
+ ]
+}
diff --git a/docs/src/app/components/pages/components/dialog.jsx b/docs/src/app/components/pages/components/dialog.jsx
index e0fa6ba396cf14..ddb10d3e6a34a0 100644
--- a/docs/src/app/components/pages/components/dialog.jsx
+++ b/docs/src/app/components/pages/components/dialog.jsx
@@ -11,9 +11,9 @@ export default class DialogPage extends React.Component {
super();
this.state = {
modal: false,
- showDialogStandardActions: false,
- showDialogCustomActions: false,
- showDialogScrollable: false,
+ openDialogStandardActions: false,
+ openDialogCustomActions: false,
+ openDialogScrollable: false,
};
this._handleCustomDialogCancel = this._handleCustomDialogCancel.bind(this);
this._handleCustomDialogSubmit = this._handleCustomDialogSubmit.bind(this);
@@ -76,19 +76,19 @@ export default class DialogPage extends React.Component {
desc: 'Force the user to use one of the actions in the dialog. Clicking outside the dialog will not dismiss the dialog.',
},
{
- name: 'openImmediately',
+ name: 'Deprecated: openImmediately',
type: 'bool',
header: 'default: false',
desc: 'Deprecated: Set to true to have the dialog automatically open on mount.',
},
{
- name: 'defaultIsOpen',
+ name: 'defaultOpen',
type: 'bool',
header: 'default: false',
desc: 'Set to true to have the dialog automatically open on mount.',
},
{
- name: 'isOpen',
+ name: 'open',
type: 'bool',
header: 'default: null',
desc: 'Controls whether the Dialog is opened or not.',
@@ -117,6 +117,16 @@ export default class DialogPage extends React.Component {
{
name: 'Methods',
infoArray: [
+ {
+ name: 'Deprecated: dismiss',
+ header: 'Dialog.dismiss()',
+ desc: 'Hides the dialog.',
+ },
+ {
+ name: 'Deprecated: show',
+ header: 'Dialog.show()',
+ desc: 'Shows the dialog.',
+ },
{
name: 'isOpen',
header: 'Dialog.isOpen()',
@@ -127,6 +137,16 @@ export default class DialogPage extends React.Component {
{
name: 'Events',
infoArray: [
+ {
+ name: 'Deprecated: onDismiss',
+ header: 'function()',
+ desc: 'Fired when the dialog is dismissed.',
+ },
+ {
+ name: 'Deprecated: onShow',
+ header: 'function()',
+ desc: 'Fired when the dialog is shown.',
+ },
{
name: 'onRequestClose',
header: 'function(buttonClicked)',
@@ -182,7 +202,7 @@ export default class DialogPage extends React.Component {
title="Dialog With Standard Actions"
actions={standardActions}
actionFocus="submit"
- isOpen={this.state.showDialogStandardActions}
+ open={this.state.openDialogStandardActions}
onRequestClose={this._handleRequestClose}>
The actions in this window are created from the json that's passed in.
@@ -191,7 +211,7 @@ export default class DialogPage extends React.Component {
ref="customDialog"
title="Dialog With Custom Actions"
actions={customActions}
- isOpen={this.state.showDialogCustomActions}
+ open={this.state.openDialogCustomActions}
onRequestClose={this._handleRequestClose}>
The actions in this window were passed in as an array of react objects.
@@ -207,7 +227,7 @@ export default class DialogPage extends React.Component {
actions={scrollableCustomActions}
autoDetectWindowHeight={true}
autoScrollBodyContent={true}
- isOpen={this.state.showDialogScrollable}
+ open={this.state.openDialogScrollable}
onRequestClose={this._handleRequestClose}>
Really long content
@@ -225,13 +245,13 @@ export default class DialogPage extends React.Component {
_handleCustomDialogCancel() {
this.setState({
- showDialogCustomActions: true,
+ openDialogCustomActions: true,
});
}
_handleCustomDialogSubmit() {
this.setState({
- showDialogCustomActions: true,
+ openDialogCustomActions: true,
});
}
@@ -241,40 +261,40 @@ export default class DialogPage extends React.Component {
_handleScrollableDialogCancel() {
this.setState({
- showDialogScrollable: false,
+ openDialogScrollable: false,
});
}
_handleScrollableDialogSubmit() {
this.setState({
- showDialogScrollable: false,
+ openDialogScrollable: false,
});
}
_handleCustomDialogTouchTap() {
this.setState({
- showDialogScrollable: true,
+ openDialogScrollable: true,
});
}
_handleStandardDialogTouchTap() {
this.setState({
- showDialogStandardActions: true,
+ openDialogStandardActions: true,
});
}
_handleScrollableDialogTouchTap() {
this.setState({
- showDialogScrollable: true,
+ openDialogScrollable: true,
});
}
_handleRequestClose(buttonClicked) {
if (!buttonClicked && this.state.modal) return;
this.setState({
- showDialogStandardActions: false,
- showDialogCustomActions: false,
- showDialogScrollable: false,
+ openDialogStandardActions: false,
+ openDialogCustomActions: false,
+ openDialogScrollable: false,
});
}
diff --git a/package.json b/package.json
index 201aeb349d6527..ea5389ef16309f 100644
--- a/package.json
+++ b/package.json
@@ -10,7 +10,7 @@
"test-base": "./node_modules/.bin/karma start",
"prebuild": "rimraf lib",
"lint": "gulp eslint",
- "build": "babel --stage 1 ./src --out-dir ./lib",
+ "build": "babel ./src --out-dir ./lib",
"prepublish": "npm run build"
},
"keywords": [
@@ -49,6 +49,7 @@
"babel-core": "^5.8.21",
"babel-eslint": "^4.1.3",
"babel-loader": "^5.3.2",
+ "babel-plugin-dev-expression": "^0.1.0",
"babel-runtime": "^5.8.25",
"babelify": "^6.1.3",
"browserify-istanbul": "^0.2.1",
diff --git a/src/date-picker/date-picker-dialog.jsx b/src/date-picker/date-picker-dialog.jsx
index 367a3cf0830415..8d6cd1d026d191 100644
--- a/src/date-picker/date-picker-dialog.jsx
+++ b/src/date-picker/date-picker-dialog.jsx
@@ -83,6 +83,7 @@ const DatePickerDialog = React.createClass({
getInitialState() {
return {
+ open: false,
isCalendarActive: false,
muiTheme: this.context.muiTheme ? this.context.muiTheme : ThemeManager.getMuiTheme(DefaultRawTheme),
};
@@ -160,7 +161,9 @@ const DatePickerDialog = React.createClass({
onDismiss={this._handleDialogDismiss}
onShow={this._handleDialogShow}
onClickAway={this._handleDialogClickAway}
- repositionOnUpdate={false}>
+ repositionOnUpdate={false}
+ open={this.state.open}
+ onRequestClose={this.dismiss}>
{title}
-
{this.props.children}
-
{actions}
}
@@ -283,23 +287,20 @@ let Dialog = React.createClass({
},
_testDeprecations() {
- if (process.env.NODE_ENV !== 'production') {
- warning(!this.props.hasOwnProperty('openImmediately'),
- 'openImmediately has been deprecated in favor of defaultIsOpen');
+ warning(!this.props.hasOwnProperty('openImmediately'),
+ 'openImmediately has been deprecated in favor of defaultOpen');
- warning(!this.props.hasOwnProperty('onShow'),
- 'onShow will be removed in favor of explicitly setting isOpen');
+ warning(!this.props.hasOwnProperty('onShow'),
+ 'onShow will be removed in favor of explicitly setting open');
- warning(!this.props.hasOwnProperty('onDismiss'),
- 'onDismiss will be removed in favor of explicitly setting isOpen and can be replaced by onRequestClose');
+ warning(!this.props.hasOwnProperty('onDismiss'),
+ 'onDismiss will be removed in favor of explicitly setting open and can be replaced by onRequestClose');
- warning(!this.props.hasOwnProperty('modal'),
- 'modal will be removed in favor of explicitly setting isOpen and onRequestClose');
- }
+ warning(!this.props.hasOwnProperty('modal'),
+ 'modal will be removed in favor of explicitly setting open and onRequestClose');
},
_getAction(actionJSON, key) {
- let styles = {marginRight: 8};
let props = {
key: key,
secondary: true,
@@ -313,8 +314,11 @@ let Dialog = React.createClass({
}
},
label: actionJSON.text,
- style: styles,
+ style: {
+ marginRight: 8,
+ },
};
+
if (actionJSON.ref) {
props.ref = actionJSON.ref;
props.keyboardFocused = actionJSON.ref === this.props.actionFocus;
@@ -324,15 +328,14 @@ let Dialog = React.createClass({
}
return (
-
+
);
},
_getActionsContainer(actions) {
let actionContainer;
let actionObjects = [];
- let actionStyle = {
+ const actionStyle = {
boxSizing: 'border-box',
WebkitTapHighlightColor: 'rgba(0,0,0,0)',
padding: 8,
@@ -399,30 +402,34 @@ let Dialog = React.createClass({
},
show() {
- if (process.env.NODE_ENV !== 'production')
- warning(false, 'show has been deprecated in favor of explicitly setting the isOpen property.');
+ warning(false, 'show has been deprecated in favor of explicitly setting the open property.');
this._show();
},
_onShow() {
- if (this.props.onShow) this.props.onShow();
+ if (this.props.onShow) {
+ this.props.onShow();
+ }
},
_show() {
this.refs.dialogOverlay.preventScrolling();
- this.setState({ open: true }, this._onShow);
+ this.setState({
+ open: true,
+ }, this._onShow);
},
dismiss() {
- if (process.env.NODE_ENV !== 'production')
- warning(false, 'dismiss has been deprecated in favor of explicitly setting the isOpen property.');
+ warning(false, 'dismiss has been deprecated in favor of explicitly setting the open property.');
this._dismiss();
},
_onDismiss() {
- if (this.props.onDismiss) this.props.onDismiss();
+ if (this.props.onDismiss) {
+ this.props.onDismiss();
+ }
},
_dismiss() {
@@ -430,27 +437,34 @@ let Dialog = React.createClass({
this.refs.dialogOverlay.allowScrolling();
});
- this.setState({ open: false }, this._onDismiss);
+ this.setState({
+ open: false,
+ }, this._onDismiss);
},
_requestClose(buttonClicked) {
- if (process.env.NODE_ENV !== 'production')
- warning(!this.props.hasOwnProperty('modal'),
- 'modal will be removed in favor of explicitly setting isOpen and onRequestClose');
+ warning(!this.props.hasOwnProperty('modal'),
+ 'modal will be removed in favor of explicitly setting open and onRequestClose');
- if (!buttonClicked && this.props.modal) return;
+ if (!buttonClicked && this.props.modal) {
+ return;
+ }
- // Close the dialog if the isOpen state is not explicitly set.
- if (this.props.isOpen === null) this._dismiss();
- if (this.props.onRequestClose) this.props.onRequestClose(!!buttonClicked);
+ // Close the dialog if the open state is not explicitly set.
+ if (this.props.open === null) {
+ this._dismiss();
+ }
+ if (this.props.onRequestClose) {
+ this.props.onRequestClose(!!buttonClicked);
+ }
},
- _handleOverlayTouchTap(e) {
+ _handleOverlayTouchTap() {
this._requestClose(false);
},
- _handleWindowKeyUp(e) {
- if (e.keyCode === KeyCode.ESC) {
+ _handleWindowKeyUp(event) {
+ if (event.keyCode === KeyCode.ESC) {
this._requestClose(false);
}
},
diff --git a/src/time-picker/time-picker-dialog.jsx b/src/time-picker/time-picker-dialog.jsx
index 5c1c33b3bb07a0..88d36da21f2aae 100644
--- a/src/time-picker/time-picker-dialog.jsx
+++ b/src/time-picker/time-picker-dialog.jsx
@@ -37,6 +37,7 @@ const TimePickerDialog = React.createClass({
getInitialState () {
return {
+ open: false,
muiTheme: this.context.muiTheme ? this.context.muiTheme : ThemeManager.getMuiTheme(DefaultRawTheme),
};
},
@@ -91,9 +92,9 @@ const TimePickerDialog = React.createClass({
secondary={true}
onTouchTap={this._handleOKTouchTap} />,
];
-
+
const onClockChangeMinutes = (autoOk === true ? this._handleOKTouchTap : undefined);
-
+
return (