100) {
window.clearInterval(id);
- };
+ }
}, 1000);
},
diff --git a/docs/src/app/components/pages/components/snackbar.jsx b/docs/src/app/components/pages/components/snackbar.jsx
index 1a03c15eb45f49..3fbd1cc56b66a4 100644
--- a/docs/src/app/components/pages/components/snackbar.jsx
+++ b/docs/src/app/components/pages/components/snackbar.jsx
@@ -106,7 +106,7 @@ class SnackbarPage extends React.Component {
_handleAction() {
//We can add more code here! In this example, we'll just include an alert.
- alert("We removed the event from your calendar.");
+ window.alert("We removed the event from your calendar.");
}
}
diff --git a/docs/src/app/components/pages/customization/inline-styles.jsx b/docs/src/app/components/pages/customization/inline-styles.jsx
index fa89fd25e16f53..fced0a9b805355 100644
--- a/docs/src/app/components/pages/customization/inline-styles.jsx
+++ b/docs/src/app/components/pages/customization/inline-styles.jsx
@@ -125,6 +125,6 @@ class InlineStyles extends React.Component {
);
}
-};
+}
-module.exports = InlineStyles;
\ No newline at end of file
+module.exports = InlineStyles;
diff --git a/docs/src/app/components/pages/get-started.jsx b/docs/src/app/components/pages/get-started.jsx
index 73e09c3579ffd0..6f7ba96304984a 100644
--- a/docs/src/app/components/pages/get-started.jsx
+++ b/docs/src/app/components/pages/get-started.jsx
@@ -2,7 +2,7 @@ var React = require('react');
var mui = require('mui');
var CodeBlock = require('../code-example/code-block.jsx');
var FullWidthSection = require('../full-width-section.jsx');
-var Spacing = mui.Styles.Spacing;
+var {Spacing, Typography} = mui.Styles;
class GetStarted extends React.Component {
@@ -34,7 +34,7 @@ class GetStarted extends React.Component {
color: '#f00'//Typography.textDarkBlack
},
codeExample: {
- backgroundColor: canvasColor,
+ backgroundColor: this.context.muiTheme.palette.canvasColor,
marginBottom: '32px'
}
};
@@ -141,4 +141,8 @@ class GetStarted extends React.Component {
}
+GetStarted.contextTypes = {
+ muiTheme: React.PropTypes.object
+};
+
module.exports = GetStarted;
diff --git a/docs/src/app/components/svg-icons/action-grade.jsx b/docs/src/app/components/svg-icons/action-grade.jsx
index 68856d406d04ac..2afb1f601c8e06 100644
--- a/docs/src/app/components/svg-icons/action-grade.jsx
+++ b/docs/src/app/components/svg-icons/action-grade.jsx
@@ -14,4 +14,4 @@ var ActionGrade = React.createClass({
});
-module.exports = ActionGrade;
\ No newline at end of file
+module.exports = ActionGrade;
diff --git a/package.json b/package.json
index 1a40015d700022..9b8c4995a416a3 100644
--- a/package.json
+++ b/package.json
@@ -7,9 +7,8 @@
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"prebuild": "rm -rf lib",
- "build:js": "./node_modules/.bin/jsx --harmony ./src ./lib",
- "build:jsx": "./node_modules/.bin/jsx --harmony -x jsx ./src ./lib",
- "build": "npm run build:js && npm run build:jsx",
+ "jshint": "./node_modules/.bin/jsxhint --harmony src/* src/**/* src/**/**/* --exclude src/utils/modernizr.custom.js",
+ "build": "npm run jshint && ./node_modules/.bin/babel --stage 1 ./src --out-dir ./lib",
"prepublish": "npm run build"
},
"keywords": [
@@ -37,9 +36,9 @@
"react-tap-event-plugin": ">=0.1.3"
},
"devDependencies": {
- "react-tools": "^0.13",
- "browserify": "^7.0.3",
- "reactify": "^1.1.0",
- "react-router": "^0.13"
+ "babel": "^5.4.3",
+ "jsxhint": "^0.15.0",
+ "react": "^0.13.3",
+ "react-tap-event-plugin": "^0.1.6"
}
}
diff --git a/src/circular-progress.jsx b/src/circular-progress.jsx
index 628caed57f9586..470628c1c46888 100644
--- a/src/circular-progress.jsx
+++ b/src/circular-progress.jsx
@@ -51,7 +51,7 @@ var CircularProgress = React.createClass({
if (this.props.mode != "indeterminate") return;
- if (step == 0) {
+ if (step === 0) {
path.style.strokeDasharray = "1, 200";
path.style.strokeDashoffset = 0;
diff --git a/src/dialog-window.jsx b/src/dialog-window.jsx
index e018cb2a7bb09f..398a3da9678f06 100644
--- a/src/dialog-window.jsx
+++ b/src/dialog-window.jsx
@@ -190,7 +190,7 @@ var DialogWindow = React.createClass({
currentAction = this._getAction(currentAction, i);
}
actionObjects.push(currentAction);
- };
+ }
actionContainer = (
diff --git a/src/enhanced-switch.jsx b/src/enhanced-switch.jsx
index 0814911329962e..47d9be70789b57 100644
--- a/src/enhanced-switch.jsx
+++ b/src/enhanced-switch.jsx
@@ -63,7 +63,6 @@ var EnhancedSwitch = React.createClass({
componentDidMount: function() {
var inputNode = React.findDOMNode(this.refs.checkbox);
if (!this.props.switched ||
- this.props.switched == undefined ||
inputNode.checked != this.props.switched) this.props.onParentShouldUpdate(inputNode.checked);
window.addEventListener("resize", this._handleResize);
@@ -94,7 +93,7 @@ var EnhancedSwitch = React.createClass({
newState.switched = nextProps.defaultSwitched;
}
- if (newState.switched != undefined && (newState.switched != this.props.switched)) this.props.onParentShouldUpdate(newState.switched);
+ if (newState.switched !== undefined && (newState.switched != this.props.switched)) this.props.onParentShouldUpdate(newState.switched);
},
getTheme: function() {
@@ -297,7 +296,7 @@ var EnhancedSwitch = React.createClass({
// no callback here because there is no event
setSwitched: function(newSwitchedValue) {
- if (!this.props.hasOwnProperty('checked') || this.props.checked == false) {
+ if (!this.props.hasOwnProperty('checked') || this.props.checked === false) {
this.props.onParentShouldUpdate(newSwitchedValue);
React.findDOMNode(this.refs.checkbox).checked = newSwitchedValue;
} else if (process.env.NODE_ENV !== 'production') {
diff --git a/src/enhanced-textarea.jsx b/src/enhanced-textarea.jsx
index 0e97298e2bb041..e02e4f4f7f5528 100644
--- a/src/enhanced-textarea.jsx
+++ b/src/enhanced-textarea.jsx
@@ -95,7 +95,6 @@ var EnhancedTextarea = React.createClass({
diff --git a/src/flat-button.jsx b/src/flat-button.jsx
index 0cfe86fb74c53e..1611356bb6569e 100644
--- a/src/flat-button.jsx
+++ b/src/flat-button.jsx
@@ -124,7 +124,7 @@ var FlatButton = React.createClass({
{label}
);
- };
+ }
return (
- {icon}
+ {iconElement}
{this.props.children}
diff --git a/src/icon-button.jsx b/src/icon-button.jsx
index 5255b55df3b530..c9f34e936361a9 100644
--- a/src/icon-button.jsx
+++ b/src/icon-button.jsx
@@ -59,8 +59,6 @@ var IconButton = React.createClass({
getStyles: function() {
var styles = {
root: {
- height: 48,
- width: 48,
position: 'relative',
boxSizing: 'border-box',
transition: Transitions.easeOut(),
@@ -100,13 +98,13 @@ var IconButton = React.createClass({
tooltip,
touch,
...other } = this.props;
- var tooltip;
+ var tooltipElement;
var fonticon;
var styles = this.getStyles();
if (this.props.tooltip) {
- tooltip = (
+ tooltipElement = (
- {tooltip}
+ {tooltipElement}
{fonticon}
{this.props.children}
diff --git a/src/linear-progress.jsx b/src/linear-progress.jsx
index aa653fa36dbdab..4d04e5abd7bb42 100644
--- a/src/linear-progress.jsx
+++ b/src/linear-progress.jsx
@@ -59,7 +59,7 @@ var LinearProgress = React.createClass({
if (!this.isMounted()) return;
if (this.props.mode != "indeterminate") return;
- if (step == 0) {
+ if (step === 0) {
barElement.style.left = stepValues[0][0] + "%";
barElement.style.right = stepValues[0][1] + "%";
} else if (step == 1) {
diff --git a/src/menu/menu-item.jsx b/src/menu/menu-item.jsx
index 4011e017d09e78..34a52a585d4a37 100644
--- a/src/menu/menu-item.jsx
+++ b/src/menu/menu-item.jsx
@@ -123,7 +123,7 @@ var MenuItem = React.createClass({
var iconRight;
var attribute;
var number;
- var toggle;
+ var toggleElement;
var styles = this.getStyles();
@@ -145,7 +145,7 @@ var MenuItem = React.createClass({
style,
...other
} = this.props;
- toggle = ;
+ toggleElement = ;
}
return (
@@ -168,7 +168,7 @@ var MenuItem = React.createClass({
{data}
{attribute}
{number}
- {toggle}
+ {toggleElement}
{iconRight}
diff --git a/src/menu/menu.jsx b/src/menu/menu.jsx
index b8dee78f525d28..7bfac9b34560c0 100644
--- a/src/menu/menu.jsx
+++ b/src/menu/menu.jsx
@@ -255,7 +255,7 @@ var Menu = React.createClass({
isSelected = i === this.props.selectedIndex;
isDisabled = (menuItem.disabled === undefined) ? false : menuItem.disabled;
- var {
+ let {
icon,
data,
attribute,
@@ -288,13 +288,13 @@ var Menu = React.createClass({
index={i}
className={this.props.menuItemClassNameSubheader}
style={this.mergeAndPrefix(styles.subheader)}
- firstChild={i == 0}
+ firstChild={i === 0}
text={menuItem.text} />
);
break;
case MenuItem.Types.NESTED:
- var {
+ let {
ref,
key,
index,
diff --git a/src/menu/subheader-menu-item.jsx b/src/menu/subheader-menu-item.jsx
index 25d8e7ba46623d..b36f5bd0099139 100644
--- a/src/menu/subheader-menu-item.jsx
+++ b/src/menu/subheader-menu-item.jsx
@@ -34,7 +34,6 @@ var SubheaderMenuItem = React.createClass({
fontSize: '13px',
letterSpacing: 0,
fontWeight: Typography.fontWeightMedium,
- color: Typography.textDarkBlack,
margin: 0,
height: subheaderHeight + gutterMini,
lineHeight: subheaderHeight + 'px',
@@ -70,4 +69,4 @@ var SubheaderMenuItem = React.createClass({
});
-module.exports = SubheaderMenuItem;
\ No newline at end of file
+module.exports = SubheaderMenuItem;
diff --git a/src/radio-button-group.jsx b/src/radio-button-group.jsx
index 38ce4a175bb13f..e7bb4e5a757d61 100644
--- a/src/radio-button-group.jsx
+++ b/src/radio-button-group.jsx
@@ -74,7 +74,7 @@ var RadioButtonGroup = React.createClass({
},
_updateRadioButtons: function(newSelection) {
- if (this.state.numberCheckedRadioButtons == 0) {
+ if (this.state.numberCheckedRadioButtons === 0) {
this.setState({selected: newSelection});
} else if (process.env.NODE_ENV !== 'production') {
var message = "Cannot select a different radio button while another radio button " +
@@ -87,7 +87,7 @@ var RadioButtonGroup = React.createClass({
this._updateRadioButtons(newSelection);
// Successful update
- if (this.state.numberCheckedRadioButtons == 0) {
+ if (this.state.numberCheckedRadioButtons === 0) {
if (this.props.onChange) this.props.onChange(e, newSelection);
}
},
diff --git a/src/ripples/touch-ripple.jsx b/src/ripples/touch-ripple.jsx
index 25975e7e40c78c..8bd82c92528db4 100644
--- a/src/ripples/touch-ripple.jsx
+++ b/src/ripples/touch-ripple.jsx
@@ -56,13 +56,13 @@ var TouchRipple = React.createClass({
//Do nothing if we're starting a click-event-generated ripple
//while having touch-generated ripples
if (!isRippleTouchGenerated) {
- for (var i = 0; i < ripples.length; i++) {
+ for (let i = 0; i < ripples.length; i++) {
if (ripples[i].touchGenerated) return;
}
}
//Start the next unstarted ripple
- for (var i = 0; i < ripples.length; i++) {
+ for (let i = 0; i < ripples.length; i++) {
ripple = ripples[i];
if (!ripple.started) {
ripple.started = true;
@@ -70,7 +70,7 @@ var TouchRipple = React.createClass({
ripple.style = style;
break;
}
- };
+ }
//Add an unstarted ripple at the end
ripples.push({
@@ -98,7 +98,7 @@ var TouchRipple = React.createClass({
endingRipple = ripple;
break;
}
- };
+ }
//Only update if a ripple was found
if (endingRipple) {
diff --git a/src/slider.jsx b/src/slider.jsx
index 7ca958880c9637..192615134aa903 100644
--- a/src/slider.jsx
+++ b/src/slider.jsx
@@ -296,10 +296,6 @@ var Slider = React.createClass({
this.setValue(0);
},
- _handleWindowKeydown: function(e) {
- if (e.keyCode == KeyCode.TAB) this._tabPressed = true;
- },
-
_onClick: function (e) {
this._tabPressed = false;
// let draggable handle the slider
diff --git a/src/styles/themes/light-theme.js b/src/styles/themes/light-theme.js
index 2ef0aab7eaef00..2b2f508d9d7643 100644
--- a/src/styles/themes/light-theme.js
+++ b/src/styles/themes/light-theme.js
@@ -145,8 +145,7 @@ var LightTheme = {
titleFontSize: 20,
iconColor: 'rgba(0, 0, 0, .40)',
separatorColor: 'rgba(0, 0, 0, .175)',
- menuHoverColor: 'rgba(0, 0, 0, .10)',
- menuHoverColor: Colors.white
+ menuHoverColor: 'rgba(0, 0, 0, .10)'
}
};
diff --git a/src/styles/typography.js b/src/styles/typography.js
index 9b166cf2f48ba0..674100dc7f8f39 100644
--- a/src/styles/typography.js
+++ b/src/styles/typography.js
@@ -1,22 +1,22 @@
var Colors = require('./colors');
-var typography = new (function() {
+var Typography = function () {
- // text colors
- this.textFullBlack = Colors.fullBlack;
- this.textDarkBlack = Colors.darkBlack;
- this.textLightBlack = Colors.lightBlack;
- this.textMinBlack = Colors.minBlack;
- this.textFullWhite = Colors.fullWhite;
- this.textDarkWhite = Colors.darkWhite;
- this.textLightWhite = Colors.lightWhite;
+ // text colors
+ this.textFullBlack = Colors.fullBlack;
+ this.textDarkBlack = Colors.darkBlack;
+ this.textLightBlack = Colors.lightBlack;
+ this.textMinBlack = Colors.minBlack;
+ this.textFullWhite = Colors.fullWhite;
+ this.textDarkWhite = Colors.darkWhite;
+ this.textLightWhite = Colors.lightWhite;
- // font weight
- this.fontWeightLight = 300;
- this.fontWeightNormal = 400;
- this.fontWeightMedium = 500;
+ // font weight
+ this.fontWeightLight = 300;
+ this.fontWeightNormal = 400;
+ this.fontWeightMedium = 500;
- this.fontStyleButtonFontSize = 14;
-});
+ this.fontStyleButtonFontSize = 14;
+};
-module.exports = typography;
\ No newline at end of file
+module.exports = new Typography();
diff --git a/src/tabs/tab.jsx b/src/tabs/tab.jsx
index 36c7242c6803e6..b37786c96ad0d9 100644
--- a/src/tabs/tab.jsx
+++ b/src/tabs/tab.jsx
@@ -23,7 +23,6 @@ var Tab = React.createClass({
render: function(){
var styles = this.mergeAndPrefix({
'display': 'table-cell',
- 'height': '100%',
'cursor': 'pointer',
'textAlign': 'center',
'verticalAlign': 'middle',
diff --git a/src/time-picker/clock-pointer.jsx b/src/time-picker/clock-pointer.jsx
index 28ee40e6d7d364..a80a4e0f4693b3 100644
--- a/src/time-picker/clock-pointer.jsx
+++ b/src/time-picker/clock-pointer.jsx
@@ -91,7 +91,7 @@ var ClockPointer = React.createClass({
if(!this.state.inner ){
styles.root.height = "40%";
- };
+ }
if(this.props.hasSelected){
styles.mark.display = "none";
diff --git a/src/toolbar/toolbar-group.jsx b/src/toolbar/toolbar-group.jsx
index c9a2e83a7fb2b1..e2b1021b0b2df0 100644
--- a/src/toolbar/toolbar-group.jsx
+++ b/src/toolbar/toolbar-group.jsx
@@ -96,7 +96,6 @@ var ToolbarGroup = React.createClass({
styleControlBg: styles.dropDownMenu.controlBg,
styleUnderline: styles.dropDownMenu.underline
});
- break;
case 'DropDownIcon' :
return React.cloneElement(currentChild, {
style: {float: 'left'},
diff --git a/src/transition-groups/slide-in-child.jsx b/src/transition-groups/slide-in-child.jsx
index cef64727ba9cbe..59de13fa3d6cfb 100644
--- a/src/transition-groups/slide-in-child.jsx
+++ b/src/transition-groups/slide-in-child.jsx
@@ -53,7 +53,7 @@ var SlideInChild = React.createClass({
...other
} = this.props;
- var styles = this.mergeAndPrefix({
+ styles = this.mergeAndPrefix({
position: 'absolute',
height: '100%',
width: '100%',
diff --git a/src/utils/color-manipulator.js b/src/utils/color-manipulator.js
index 24eab17ef2041c..3d7e814b0ed007 100644
--- a/src/utils/color-manipulator.js
+++ b/src/utils/color-manipulator.js
@@ -115,7 +115,7 @@ module.exports = {
},
darken: function(color, amount) {
- var color = this._decomposeColor(color);
+ color = this._decomposeColor(color);
if (color.type.indexOf('hsl') > -1) {
color.values[2] += amount;
@@ -172,7 +172,7 @@ module.exports = {
var ratio = this.contrastRatio(background, foreground);
- for (level in levels) {
+ for (var level in levels) {
var range = levels[level].range;
if (ratio >= range[0] && ratio <= range[1]) return level;
}
diff --git a/src/utils/css-event.js b/src/utils/css-event.js
index 2c484dee45783c..243e10ad355508 100644
--- a/src/utils/css-event.js
+++ b/src/utils/css-event.js
@@ -4,7 +4,6 @@ module.exports = {
_testSupportedProps: function(props) {
var i,
- undefined,
el = document.createElement('div');
for (i in props) {
@@ -49,4 +48,4 @@ module.exports = {
});
}
-};
\ No newline at end of file
+};
diff --git a/src/utils/date-time.js b/src/utils/date-time.js
index 856bea6685864c..bbbaeb667b34cc 100644
--- a/src/utils/date-time.js
+++ b/src/utils/date-time.js
@@ -87,9 +87,9 @@ module.exports = {
var week;
var weekArray = [];
- for (var i = 1; i <= daysInMonth; i++) {
+ for (let i = 1; i <= daysInMonth; i++) {
dayArray.push(new Date(d.getFullYear(), d.getMonth(), i));
- };
+ }
while (dayArray.length) {
firstDayOfWeek = dayArray[0].getDay();
@@ -97,9 +97,9 @@ module.exports = {
emptyDays = 7 - daysInWeek;
week = dayArray.splice(0, daysInWeek);
- for (var i = 0; i < emptyDays; i++) {
+ for (let i = 0; i < emptyDays; i++) {
week.unshift(null);
- };
+ }
weekArray.push(week);
}
@@ -129,4 +129,4 @@ module.exports = {
return m;
}
-}
\ No newline at end of file
+}