react-slidedown
Advanced tools
Comparing version 1.3.0 to 1.4.0
@@ -5,3 +5,4 @@ "use strict"; | ||
var react_1 = tslib_1.__importDefault(require("react")); | ||
var TransitionGroup_1 = tslib_1.__importDefault(require("react-transition-group/TransitionGroup")); | ||
var react_lifecycles_compat_1 = require("react-lifecycles-compat"); | ||
var TransitionGroup_1 = tslib_1.__importDefault(require("./TransitionGroup/TransitionGroup")); | ||
var SlideDownContent = (function (_super) { | ||
@@ -57,12 +58,15 @@ tslib_1.__extends(SlideDownContent, _super); | ||
}; | ||
SlideDownContent.prototype.componentWillUpdate = function () { | ||
SlideDownContent.prototype.getSnapshotBeforeUpdate = function () { | ||
if (this.callbacks.length === 0) { | ||
this.element.style.height = this.element.getBoundingClientRect().height + 'px'; | ||
return this.element.getBoundingClientRect().height + 'px'; | ||
} | ||
else { | ||
return null; | ||
} | ||
}; | ||
SlideDownContent.prototype.componentDidUpdate = function () { | ||
SlideDownContent.prototype.componentDidUpdate = function (prevProps, prevState, snapshot) { | ||
var callback = this.callbacks.shift(); | ||
callback && callback(); | ||
if (this.callbacks.length === 0) { | ||
var prevHeight = getComputedStyle(this.element).height; | ||
var prevHeight = snapshot || getComputedStyle(this.element).height; | ||
this.startTransition(prevHeight); | ||
@@ -101,8 +105,9 @@ } | ||
} | ||
var SlideDownContentCompat = react_lifecycles_compat_1.polyfill(SlideDownContent); | ||
function SlideDown(props) { | ||
var children = props.children, attrs = tslib_1.__rest(props, ["children"]); | ||
var hasContent = (children && react_1.default.Children.count(children) !== 0); | ||
return (react_1.default.createElement(TransitionGroup_1.default, { component: SlideDownWrapper }, hasContent && react_1.default.createElement(SlideDownContent, tslib_1.__assign({ key: 'content' }, attrs), children))); | ||
return (react_1.default.createElement(TransitionGroup_1.default, { component: SlideDownWrapper }, hasContent && react_1.default.createElement(SlideDownContentCompat, tslib_1.__assign({ key: 'content' }, attrs), children))); | ||
} | ||
exports.SlideDown = SlideDown; | ||
//# sourceMappingURL=slidedown.js.map |
{ | ||
"name": "react-slidedown", | ||
"version": "1.3.0", | ||
"version": "1.4.0", | ||
"description": "Component for animating height during mount/unmount using a CSS transition", | ||
@@ -20,31 +20,42 @@ "main": "lib/slidedown.js", | ||
"devDependencies": { | ||
"@types/chai": "^4.0.4", | ||
"@types/enzyme": "^3.1.0", | ||
"@types/chai": "^4.1.3", | ||
"@types/enzyme": "^3.1.10", | ||
"@types/node": "^8.10.17", | ||
"@types/react": "16.0.16", | ||
"@types/react-dom": "^16.0.2", | ||
"browserify": "^15.2.0", | ||
"@types/react-dom": "^16.0.5", | ||
"browserify": "^16.2.2", | ||
"chai": "^4.1.2", | ||
"concurrently": "^3.4.0", | ||
"enzyme": "^3.1.0", | ||
"enzyme-adapter-react-16": "^1.0.2", | ||
"karma": "^2.0.0", | ||
"karma-browserify": "^5.1.1", | ||
"karma-chrome-launcher": "^2.1.1", | ||
"concurrently": "^3.5.1", | ||
"enzyme": "^3.3.0", | ||
"enzyme-adapter-react-16": "^1.1.1", | ||
"karma": "^2.0.2", | ||
"karma-browserify": "^5.2.0", | ||
"karma-chrome-launcher": "^2.2.0", | ||
"karma-mocha": "^1.3.0", | ||
"karma-mocha-reporter": "^2.2.5", | ||
"mocha": "^5.0.0", | ||
"mocha": "^5.2.0", | ||
"purecss": "^1.0.0", | ||
"react": "^16.0.0", | ||
"react-dom": "^16.0.0", | ||
"typescript": "2.7.0-rc", | ||
"watchify": "^3.9.0" | ||
"react": "^16.4.0", | ||
"react-dom": "^16.4.0", | ||
"typescript": "^2.8.3", | ||
"watchify": "^3.11.0" | ||
}, | ||
"dependencies": { | ||
"react-transition-group": "^1.2.0", | ||
"chain-function": "^1.0.1", | ||
"prop-types": "^15.6.2", | ||
"react-lifecycles-compat": "^3.0.4", | ||
"tslib": "^1.9.0" | ||
}, | ||
"peerDependencies": { | ||
"react": "^15.0.0 || ^16.0.0", | ||
"react-dom": "^15.0.0 || ^16.0.0" | ||
}, | ||
"files": [ | ||
"lib/slidedown.js", | ||
"lib/slidedown.css", | ||
"lib/slidedown.js.map" | ||
"lib/slidedown.js.map", | ||
"lib/TransitionGroup/ChildMappings.js", | ||
"lib/TransitionGroup/ChildMappings.js.map", | ||
"lib/TransitionGroup/TransitionGroup.js", | ||
"lib/TransitionGroup/TransitionGroup.js.map" | ||
], | ||
@@ -51,0 +62,0 @@ "repository": "frankwallis/react-slidedown", |
@@ -48,2 +48,10 @@ react-slidedown | ||
## Props | ||
| Property | Type | Default | Required? | Description | | ||
|:---|:---|:---|:---:|:---| | ||
| closed | Boolean | `false` | No | If `false` renders in closed mode, if `true` then slides down | | ||
| className | String | | No | CSS class name to be used in addtion to the `react-slidedown` class name | | ||
| transitionOnAppear | Boolean | `true` | No | Do a transition animation on [`componentWillAppear()`](https://reactjs.org/docs/animation.html#componentwillappear) | | ||
## Example ## | ||
@@ -50,0 +58,0 @@ |
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
Mixed license
License(Experimental) Package contains multiple licenses.
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
30265
8
300
87
6
21
1
1
+ Addedchain-function@^1.0.1
+ Addedprop-types@^15.6.2
+ Addedreact-lifecycles-compat@3.0.4(transitive)
- Removedreact-transition-group@^1.2.0
- Removed@babel/runtime@7.26.0(transitive)
- Removeddom-helpers@3.4.0(transitive)
- Removedreact-transition-group@1.2.1(transitive)
- Removedregenerator-runtime@0.14.1(transitive)
- Removedwarning@3.0.0(transitive)