Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update to react 14 #83

Merged
merged 11 commits into from
Oct 22, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28,520 changes: 13,841 additions & 14,679 deletions dist/dependencies.js

Large diffs are not rendered by default.

11 changes: 6 additions & 5 deletions dist/stardust.js
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,7 @@ return webpackJsonpstardust([1],{
this.handleAbort = function () {
// Promise is resolved, confirmation is false
_this.deferred.resolve(false);
// TODO: as of React 0.14, refs returns the DOM node, not the component, his may not work anymore
_this.refs.modal.hideModal();
};

Expand Down Expand Up @@ -1059,7 +1060,7 @@ return webpackJsonpstardust([1],{
_get(Object.getPrototypeOf(Form.prototype), 'constructor', this).apply(this, arguments);

this.serializeJson = function () {
var form = _react2['default'].findDOMNode(_this.refs.form);
var form = _this.refs.form;
var json = {};

_lodash2['default'].each(['input', 'textarea', 'select'], function (tag) {
Expand Down Expand Up @@ -1533,7 +1534,7 @@ return webpackJsonpstardust([1],{
_createClass(Message, [{
key: 'componentDidMount',
value: function componentDidMount() {
this.messageElm = (0, _jquery2['default'])((0, _react.findDOMNode)(this.refs.message));
this.messageElm = (0, _jquery2['default'])(this.refs.message);
}
}, {
key: 'render',
Expand Down Expand Up @@ -2798,8 +2799,8 @@ return webpackJsonpstardust([1],{
_createClass(Checkbox, [{
key: 'componentDidMount',
value: function componentDidMount() {
this.container = (0, _jquery2['default'])(_react2['default'].findDOMNode(this.refs.container));
this.input = (0, _jquery2['default'])(_react2['default'].findDOMNode(this.refs.input));
this.container = (0, _jquery2['default'])(this.refs.container);
this.input = (0, _jquery2['default'])(this.refs.input);

this.container.checkbox({
onChange: this.props.onChange,
Expand Down Expand Up @@ -2942,7 +2943,7 @@ return webpackJsonpstardust([1],{
_createClass(Dropdown, [{
key: 'componentDidMount',
value: function componentDidMount() {
this.element = (0, _jquery2['default'])((0, _react.findDOMNode)(this.refs.select));
this.element = (0, _jquery2['default'])(this.refs.select);
this.element.dropdown();
}
}, {
Expand Down
5 changes: 3 additions & 2 deletions docs/app/DocsApp.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React, {Component, render} from 'react';
import React, {Component} from 'react';
import {render} from 'react-dom';
import stardust, {Grid, Column} from 'stardust';

import ComponentDoc from 'docs/app/Components/ComponentDoc/ComponentDoc';
Expand Down Expand Up @@ -30,4 +31,4 @@ class DocsApp extends Component {
}
}

render(<DocsApp />, document.body);
render(<DocsApp />, document.getElementById('root'));
1 change: 1 addition & 0 deletions docs/app/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

</head>
<body>
<div id="root"></div>
<script src="vendor.js"></script>
<script src="app.js"></script>
</body>
Expand Down
4 changes: 2 additions & 2 deletions gulp/tasks/watch.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import paths from '../../paths';
gulp.task('watch', 'watch and build docs', cb => {
gulp.watch([paths.src + '/**/*.js'], [
'build', // rebuild the library
'generate-doc-json', // rebuild doc info
'generate-docs-json', // rebuild doc info
]);
gulp.watch([paths.docsRoot + '/**/*.html'], ['build-doc-html']);
gulp.watch([paths.docsRoot + '/**/*.html'], ['build-docs-html']);
cb();
});
15 changes: 7 additions & 8 deletions karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import paths from './paths';
import statConfig from './webpack-stats';
import friendlyFormatter from 'eslint-friendly-formatter';
import exitPlugin from './webpack-exit-plugin';
import ENV from './ENV';

/**
* This config is for running tests on the command line and will fail on errors.
Expand All @@ -10,11 +11,9 @@ import exitPlugin from './webpack-exit-plugin';
*/
export default config => {
config.set({
browsers: [
'PhantomJS'
],
singleRun: true,
reporters: ['dots'],
browsers: ['PhantomJS'],
singleRun: !ENV.isDevelopment(),
reporters: ['mocha'],
files: [
'./node_modules/phantomjs-polyfill/bind-polyfill.js',
'./test/tests.bundle.js'
Expand Down Expand Up @@ -66,9 +65,9 @@ export default config => {
stardust: `${paths.src}/index.js`,
},
},
plugins: [
exitPlugin
],
plugins: !ENV.isDevelopment()
? [exitPlugin]
: [],
},
webpackServer: {
progress: false,
Expand Down
28 changes: 18 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,22 @@
"url": "https://github.com/TechnologyAdvice/stardust/issues"
},
"homepage": "https://github.com/TechnologyAdvice/stardust#readme",
"engines": {
"node": "0.12.7",
"npm": "3.3.5"
},
"dependencies": {
"bluebird": "^2.10.2",
"classnames": "^2.1.5",
"jquery": "^2.1.4",
"lodash": "^3.10.1",
"react": "^0.13.3"
"react-hot-loader": "^1.3.0",
"watch": "^0.16.0",
"webpack-dev-server": "^1.12.0"
},
"devDependencies": {
"babel-core": "^5.8.25",
"babel-eslint": "^4.1.3",
"babel-loader": "^5.3.2",
"bluebird": "^2.10.2",
"chai": "^3.3.0",
"classnames": "^2.1.5",
"del": "^2.0.2",
"doctrine": "^0.7.0",
"eslint": "^1.5.1",
Expand All @@ -57,27 +61,31 @@
"highlight.js": "^8.9.1",
"imports-loader": "^0.6.4",
"json-loader": "^0.5.3",
"karma": "^0.13.10",
"jquery": "^2.1.4",
"karma": "^0.13.13",
"karma-cli": "^0.1.1",
"karma-mocha": "^0.2.0",
"karma-mocha-reporter": "^1.1.1",
"karma-phantomjs-launcher": "^0.2.1",
"karma-sourcemap-loader": "^0.3.5",
"karma-webpack": "^1.7.0",
"lodash": "^3.10.1",
"mocha": "^2.3.3",
"mocha-loader": "^0.7.1",
"phantomjs": "^1.9.18",
"phantomjs-polyfill": "0.0.1",
"pre-commit": "^1.1.2",
"raw-loader": "^0.5.1",
"react": "^0.14.0",
"react-addons-test-utils": "^0.14.0",
"react-docgen": "^2.2.0",
"react-dom": "^0.14.0",
"react-highlight": "^0.5.1",
"react-hot-loader": "^1.3.0",
"require-dir": "^0.3.0",
"run-sequence": "^1.1.4",
"sinon": "git://github.com/cjohansen/Sinon.JS#b672042043517b9f84e14ed0fb8265126168778a",
"sinon-chai": "^2.8.0",
"through2": "^2.0.0",
"watch": "^0.16.0",
"webpack": "^1.12.2",
"webpack-dev-server": "^1.12.0"
"webpack": "^1.12.2"
}
}
1 change: 1 addition & 0 deletions src/addons/Confirm/Confirm.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ export default class Confirm extends Component {
handleAbort = () => {
// Promise is resolved, confirmation is false
this.deferred.resolve(false);
// TODO: as of React 0.14, refs returns the DOM node, not the component, his may not work anymore
this.refs.modal.hideModal();
};

Expand Down
2 changes: 1 addition & 1 deletion src/collections/Form/Form.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export default class Form extends Component {
};

serializeJson = () => {
const form = React.findDOMNode(this.refs.form);
const form = this.refs.form;
const json = {};

_.each(['input', 'textarea', 'select'], (tag) => {
Expand Down
4 changes: 2 additions & 2 deletions src/collections/Message/Message.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import _ from 'lodash';
import React, {Component, findDOMNode, PropTypes} from 'react';
import React, {Component, PropTypes} from 'react';
import classNames from 'classnames';
import $ from 'jquery';
import META from 'src/utils/Meta';
Expand All @@ -14,7 +14,7 @@ export default class Message extends Component {
};

componentDidMount() {
this.messageElm = $(findDOMNode(this.refs.message));
this.messageElm = $(this.refs.message);
}

handleDismiss = e => {
Expand Down
9 changes: 3 additions & 6 deletions src/collections/Table/Table.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@ import _ from 'lodash';
import React, {Children, Component, PropTypes} from 'react';
import classNames from 'classnames';
import TableColumn from './TableColumn';
import TableHeader from './TableHeader';
import TableRow from './TableRow';
import TableCell from './TableCell';
import META from 'src/utils/Meta';

export default class Table extends Component {
Expand Down Expand Up @@ -36,7 +33,7 @@ export default class Table extends Component {
? column.props.headerRenderer(this.props.data[0])
: _.startCase(column.props.dataKey);

return <TableHeader key={column.props.dataKey}>{content}</TableHeader>;
return <th className='sd-table-header' key={column.props.dataKey}>{content}</th>;
});
}

Expand All @@ -50,15 +47,15 @@ export default class Table extends Component {
content = Table.getSafeCellContents(itemContents);
}

return <TableCell key={rowIndex + column.props.dataKey}>{content}</TableCell>;
return <td key={rowIndex + column.props.dataKey} className={'sd-table-cell'}>{content}</td>;
});
}

_getRows() {
return _.map(this.props.data, (dataItem, rowIndex) => {
const cells = this._getCells(dataItem, rowIndex);

return <TableRow key={rowIndex}>{cells}</TableRow>;
return <tr className='sd-table-row' key={rowIndex}>{cells}</tr>;
});
}

Expand Down
29 changes: 0 additions & 29 deletions src/collections/Table/TableCell.js

This file was deleted.

29 changes: 0 additions & 29 deletions src/collections/Table/TableHeader.js

This file was deleted.

29 changes: 0 additions & 29 deletions src/collections/Table/TableRow.js

This file was deleted.

6 changes: 0 additions & 6 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,6 @@ import MenuItem from 'src/collections/Menu/MenuItem';
import Message from 'src/collections/Message/Message';
import Table from 'src/collections/Table/Table';
import TableColumn from 'src/collections/Table/TableColumn';
import TableCell from 'src/collections/Table/TableCell';
import TableHeader from 'src/collections/Table/TableHeader';
import TableRow from 'src/collections/Table/TableRow';

// Elements
import Button from 'src/elements/Button/Button';
Expand Down Expand Up @@ -54,9 +51,6 @@ export default {
Message,
Table,
TableColumn,
TableCell,
TableHeader,
TableRow,

// Elements
Button,
Expand Down
4 changes: 2 additions & 2 deletions src/modules/Checkbox/Checkbox.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ export default class Checkbox extends Component {
};

componentDidMount() {
this.container = $(React.findDOMNode(this.refs.container));
this.input = $(React.findDOMNode(this.refs.input));
this.container = $(this.refs.container);
this.input = $(this.refs.input);

this.container.checkbox({
onChange: this.props.onChange,
Expand Down
4 changes: 2 additions & 2 deletions src/modules/Dropdown/Dropdown.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import _ from 'lodash';
import $ from 'jquery';
import classNames from 'classnames';
import React, {Component, PropTypes, findDOMNode} from 'react';
import React, {Component, PropTypes} from 'react';
import META from 'src/utils/Meta';

export default class Dropdown extends Component {
Expand All @@ -14,7 +14,7 @@ export default class Dropdown extends Component {
};

componentDidMount() {
this.element = $(findDOMNode(this.refs.select));
this.element = $(this.refs.select);
this.element.dropdown();
}

Expand Down
2 changes: 1 addition & 1 deletion src/modules/Modal/Modal.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class Modal extends Component {
ref: 'modal',
};

state = {isShown: false}
state = {isShown: false};

showModal = () => {
this.setState({isShown: true});
Expand Down
Loading