react-height
Advanced tools
Comparing version 1.1.0 to 2.0.0
'use strict'; | ||
Object.defineProperty(exports, '__esModule', { | ||
value: true | ||
}); | ||
// Babel6 does not hack the default behaviour of ES Modules anymore, so we should export | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } | ||
var ReactHeight = require('./ReactHeight').default; | ||
var _ReactHeight = require('./ReactHeight'); | ||
var _ReactHeight2 = _interopRequireDefault(_ReactHeight); | ||
exports['default'] = _ReactHeight2['default']; | ||
module.exports = exports['default']; | ||
module.exports = ReactHeight; | ||
//# sourceMappingURL=index.js.map |
@@ -1,15 +0,9 @@ | ||
/* eslint "react/no-did-mount-set-state":0, "react/no-did-update-set-state":0 */ | ||
'use strict'; | ||
Object.defineProperty(exports, '__esModule', { | ||
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } | ||
function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; } | ||
var _react = require('react'); | ||
@@ -21,10 +15,14 @@ | ||
var ReactHeight = _react2['default'].createClass({ | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; } /* eslint "react/no-did-mount-set-state":0, "react/no-did-update-set-state":0 */ | ||
var ReactHeight = _react2.default.createClass({ | ||
displayName: 'ReactHeight', | ||
propTypes: { | ||
children: _react2['default'].PropTypes.node.isRequired, | ||
onHeightReady: _react2['default'].PropTypes.func.isRequired, | ||
hidden: _react2['default'].PropTypes.bool, | ||
dirty: _react2['default'].PropTypes.bool | ||
children: _react2.default.PropTypes.node.isRequired, | ||
onHeightReady: _react2.default.PropTypes.func.isRequired, | ||
hidden: _react2.default.PropTypes.bool, | ||
dirty: _react2.default.PropTypes.bool | ||
}, | ||
@@ -35,3 +33,2 @@ | ||
}, | ||
getInitialState: function getInitialState() { | ||
@@ -42,3 +39,2 @@ return { | ||
}, | ||
componentDidMount: function componentDidMount() { | ||
@@ -57,3 +53,2 @@ var _this = this; | ||
}, | ||
componentWillReceiveProps: function componentWillReceiveProps(_ref) { | ||
@@ -79,11 +74,10 @@ var children = _ref.children; | ||
if (height !== this.state.height) { | ||
if (height === this.state.height) { | ||
this.setState({ dirty: dirty }); | ||
} else { | ||
this.setState({ height: height, dirty: dirty }, function () { | ||
return _this2.props.onHeightReady(_this2.state.height); | ||
}); | ||
} else { | ||
this.setState({ dirty: dirty }); | ||
} | ||
}, | ||
render: function render() { | ||
@@ -104,6 +98,6 @@ var _props = this.props; | ||
if (hidden) { | ||
return _react2['default'].createElement( | ||
return _react2.default.createElement( | ||
'div', | ||
{ style: { height: 0, overflow: 'hidden' } }, | ||
_react2['default'].createElement( | ||
_react2.default.createElement( | ||
'div', | ||
@@ -116,3 +110,3 @@ _extends({ ref: 'wrapper' }, props), | ||
return _react2['default'].createElement( | ||
return _react2.default.createElement( | ||
'div', | ||
@@ -125,4 +119,3 @@ _extends({ ref: 'wrapper' }, props), | ||
exports['default'] = ReactHeight; | ||
module.exports = exports['default']; | ||
exports.default = ReactHeight; | ||
//# sourceMappingURL=ReactHeight.js.map |
{ | ||
"name": "react-height", | ||
"version": "1.1.0", | ||
"version": "2.0.0", | ||
"description": "Component-wrapper to determine and report children elements height", | ||
@@ -9,30 +9,19 @@ "main": "lib/index.js", | ||
"gh-pages": "git checkout gh-pages && git rebase origin/master --force-rebase && npm run build && git add . && git commit --amend --no-edit && git push --force && git checkout master", | ||
"build": "parallelshell -w \"npm run build:lib -s\" \"npm run build:example -s\" \"npm run build:bower -s\"", | ||
"build": "parallelshell -w \"npm run build:lib -s\" \"npm run build:ghPages -s\" \"npm run build:dist -s\" \"npm run build:min -s\"", | ||
"prebuild": "rimraf lib example build", | ||
"build:lib": "babel src --out-dir lib --source-maps --ignore src/example", | ||
"build:example": "webpack --config webpack.config.js", | ||
"build:bower": "webpack --config webpack.config.bower.js", | ||
"prepublish": "npm run build -s", | ||
"start": "webpack-dev-server --config webpack.config.development.js", | ||
"test": "babel-node node_modules/tape/bin/tape test/**/*-test.js", | ||
"test:dev": "babel-node node_modules/tape/bin/tape test/**/*-test.js | tap-nyan", | ||
"test:cov": "babel-node node_modules/isparta/bin/isparta cover --report text --report html --dir reports/coverage --include \"**/!(*-test).js\" test", | ||
"test:e2e": "node scripts/test-e2e.js", | ||
"build:lib": "cross-env NODE_ENV=production babel src --out-dir lib --source-maps --ignore src/example", | ||
"build:ghPages": "cross-env NODE_ENV=production BUILD=ghPages webpack", | ||
"build:dist": "cross-env NODE_ENV=production BUILD=dist webpack", | ||
"build:min": "cross-env NODE_ENV=production BUILD=min webpack", | ||
"prepublish": "parallelshell -w \"npm run build:lib -s\" \"npm run build:dist -s\" \"npm run build:min -s\"", | ||
"start": "cross-env NODE_ENV=development webpack-dev-server", | ||
"test": "cross-env NODE_ENV=test babel-node test", | ||
"test:dev": "cross-env NODE_ENV=test babel-node test | tap-nyan", | ||
"test:cov": "cross-env NODE_ENV=test babel-node node_modules/isparta/bin/isparta cover --report text --report html --report lcov --dir reports/coverage test", | ||
"test:e2e": "cross-env NODE_ENV=development nightwatch-autorun", | ||
"lint": "eslint --cache .", | ||
"coveralls": "minicat reports/coverage/lcov.info | coveralls", | ||
"precommit": "npm run lint -s", | ||
"prepush": "npm run test -s && npm run test:e2e -s", | ||
"postversion": "git push --follow-tags", | ||
"bower:create-repo": "./scripts/create-repo.sh", | ||
"bower:publish": "./scripts/publish.sh", | ||
"bower:register": "./scripts/register.sh" | ||
"postversion": "git push --follow-tags" | ||
}, | ||
"engines": { | ||
"node": ">=0.10" | ||
}, | ||
"os": [ | ||
"darwin", | ||
"linux", | ||
"win32" | ||
], | ||
"repository": { | ||
@@ -56,3 +45,3 @@ "type": "git", | ||
"peerDependencies": { | ||
"react": "^0.13 || ^0.14" | ||
"react": "^0.14" | ||
}, | ||
@@ -63,29 +52,38 @@ "dependencies": { | ||
"devDependencies": { | ||
"babel": "^5.8.23", | ||
"babel-core": "^5.8.25", | ||
"babel-eslint": "^4.1.3", | ||
"babel-loader": "^5.3.2", | ||
"coveralls": "^2.11.4", | ||
"eslint": "^1.7.3", | ||
"eslint-loader": "^1.1.0", | ||
"eslint-plugin-react": "^3.6.3", | ||
"glob": "^5.0.15", | ||
"html-webpack-plugin": "^1.6.2", | ||
"husky": "^0.10.1", | ||
"isparta": "^3.1.0", | ||
"babel-cli": "^6.4.0", | ||
"babel-core": "^6.4.0", | ||
"babel-eslint": "^5.0.0-beta6", | ||
"babel-loader": "^6.2.1", | ||
"babel-plugin-react-transform": "^2.0.0", | ||
"babel-plugin-transform-object-rest-spread": "^6.3.13", | ||
"babel-plugin-webpack-loaders": "^0.1.1", | ||
"babel-preset-es2015": "^6.3.13", | ||
"babel-preset-react": "^6.3.13", | ||
"codecov.io": "^0.1.6", | ||
"cross-env": "^1.0.7", | ||
"css-loader": "^0.23.1", | ||
"eslint": "^1.10.3", | ||
"eslint-loader": "^1.2.0", | ||
"eslint-plugin-react": "^3.14.0", | ||
"glob": "^6.0.4", | ||
"html-webpack-plugin": "^1.7.0", | ||
"husky": "^0.10.2", | ||
"isparta": "^4.0.0", | ||
"json-loader": "^0.5.4", | ||
"nightwatch-autorun": "^2.0.1", | ||
"minicat": "^1.0.0", | ||
"nightwatch": "^0.8.6", | ||
"node-libs-browser": "^0.5.3", | ||
"parallelshell": "^2.0.0", | ||
"react": "^0.14.0", | ||
"react-dom": "^0.14.0", | ||
"react-hot-loader": "^1.3.0", | ||
"rimraf": "^2.4.3", | ||
"selenium-standalone": "^4.7.1", | ||
"react": "^0.14.6", | ||
"react-dom": "^0.14.6", | ||
"react-transform-catch-errors": "^1.0.1", | ||
"react-transform-hmr": "^1.0.1", | ||
"redbox-react": "^1.2.0", | ||
"rimraf": "^2.5.0", | ||
"sinon": "^1.17.2", | ||
"tap-nyan": "0.0.2", | ||
"tap-xunit": "^1.2.1", | ||
"tape": "^4.2.2", | ||
"webpack": "^1.12.2", | ||
"webpack-dev-server": "^1.12.1" | ||
"tap-xunit": "^1.3.1", | ||
"tape": "^4.4.0", | ||
"webpack": "^1.12.10", | ||
"webpack-dev-server": "^1.14.0" | ||
} | ||
} |
@@ -5,6 +5,7 @@ # react-height | ||
[![Circle CI](https://circleci.com/gh/nkbt/react-height.svg?style=svg)](https://circleci.com/gh/nkbt/react-height) | ||
[![Coverage Status](https://coveralls.io/repos/nkbt/react-height/badge.svg?branch=master)](https://coveralls.io/r/nkbt/react-height?branch=master) | ||
[![Dependency Status](https://david-dm.org/nkbt/react-height.svg)](https://david-dm.org/nkbt/react-height) | ||
[![devDependency Status](https://david-dm.org/nkbt/react-height/dev-status.svg)](https://david-dm.org/nkbt/react-height#info=devDependencies) | ||
[![Circle CI](https://circleci.com/gh/nkbt/react-component-template.svg?style=shield)](https://circleci.com/gh/nkbt/react-component-template) | ||
[![Appveyor](https://ci.appveyor.com/api/projects/status/geqhoi8hj5pqkp1d?svg=true)](https://ci.appveyor.com/project/nkbt/react-height) | ||
[![codecov.io](https://codecov.io/github/nkbt/react-component-template/coverage.svg?branch=master)](https://codecov.io/github/nkbt/react-component-template?branch=master) | ||
[![Dependency Status](https://david-dm.org/nkbt/react-component-template.svg)](https://david-dm.org/nkbt/react-component-template) | ||
[![devDependency Status](https://david-dm.org/nkbt/react-component-template/dev-status.svg)](https://david-dm.org/nkbt/react-component-template#info=devDependencies) | ||
@@ -19,3 +20,3 @@ Component-wrapper to determine and report children elements height | ||
### npm | ||
### NPM | ||
@@ -26,8 +27,31 @@ ```sh | ||
### bower | ||
```js | ||
bower install --save react-height | ||
### Bower: | ||
```sh | ||
bower install --save https://npmcdn.com/react-height/bower.zip | ||
``` | ||
or in `bower.json` | ||
```json | ||
{ | ||
"dependencies": { | ||
"react-height": "https://npmcdn.com/react-height/bower.zip" | ||
} | ||
} | ||
``` | ||
then include as | ||
```html | ||
<script src="bower_components/react-height/build/react-height.js"></script> | ||
``` | ||
### 1998 Script Tag: | ||
```html | ||
<script src="https://npmcdn.com/react-height/build/react-height.js"></script> | ||
(Module exposed as `ReactHeight`) | ||
``` | ||
## Demo | ||
@@ -102,4 +126,7 @@ | ||
To run example covering `ReactHeight` features, use `npm start`, which will compile `src/example/Example.js` | ||
Currently is being developed and tested with the latest stable `Node 5` on `OSX` and `Windows`. | ||
Should be ok with Node 4, but not guaranteed. | ||
To run example covering all `ReactHeight` features, use `npm start`, which will compile `src/example/Example.js` | ||
```bash | ||
@@ -115,4 +142,16 @@ git clone git@github.com:nkbt/react-height.git | ||
## Tests | ||
```bash | ||
npm test | ||
# to run tests in watch mode for development | ||
npm run test:dev | ||
# to generate test coverage (./reports/coverage) | ||
npm run test:cov | ||
``` | ||
## License | ||
MIT |
@@ -1,4 +0,6 @@ | ||
import ReactHeight from './ReactHeight'; | ||
'use strict'; | ||
// Babel6 does not hack the default behaviour of ES Modules anymore, so we should export | ||
const ReactHeight = require('./ReactHeight').default; | ||
export default ReactHeight; | ||
module.exports = ReactHeight; |
@@ -57,6 +57,6 @@ /* eslint "react/no-did-mount-set-state":0, "react/no-did-update-set-state":0 */ | ||
if (height !== this.state.height) { | ||
if (height === this.state.height) { | ||
this.setState({dirty}); | ||
} else { | ||
this.setState({height, dirty}, () => this.props.onHeightReady(this.state.height)); | ||
} else { | ||
this.setState({dirty}); | ||
} | ||
@@ -63,0 +63,0 @@ }, |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
66375
14
477
153
35
1
1