{"_id":"@bodetree/react-smooth-collapse","_rev":"6-a3476ce57f39d6363e9c770dd379176e","name":"@bodetree/react-smooth-collapse","description":"React component for animating showing or hiding an element.","dist-tags":{"latest":"1.2.0"},"versions":{"1.2.0":{"name":"@bodetree/react-smooth-collapse","version":"1.2.0","description":"React component for animating showing or hiding an element.","main":"js/index.js","scripts":{"prepublish":"babel -s inline -d js/ src/ && flow-copy-source -v src js","example-build":"NODE_ENV=development browserify -t babelify -do example/bundle.js example/main.js","example-watch":"NODE_ENV=development-hmr watchify -v -p browserify-hmr -t babelify -do example/bundle.js example/main.js","example-build-prod":"NODE_ENV=production browserify -t babelify -do example/bundle.js example/main.js","test":"npm run lint && npm run flow_check && mocha","flow_check":"flow check","lint":"eslint .","lint-fix":"eslint . --fix"},"repository":{"type":"git","url":"git+https://github.com/StreakYC/react-smooth-collapse.git"},"keywords":["react","react-component","animation","hide","collapse"],"author":{"name":"Chris Cowan","email":"agentme49@gmail.com"},"license":"MIT","bugs":{"url":"https://github.com/StreakYC/react-smooth-collapse/issues"},"homepage":"https://github.com/StreakYC/react-smooth-collapse#readme","devDependencies":{"babel-cli":"^6.5.1","babel-eslint":"^6.0.2","babel-plugin-add-module-exports":"^0.2.1","babel-plugin-transform-runtime":"^6.5.2","babel-preset-es2015":"^6.5.0","babel-preset-react":"^6.5.0","babel-preset-react-hmre":"^1.1.0","babel-preset-stage-1":"^6.5.0","babel-register":"^6.5.2","babelify":"^7.2.0","browserify":"^13.0.0","browserify-hmr":"^0.3.1","eslint":"^3.2.2","eslint-plugin-react":"^6.0.0","flow-bin":"^0.31.1","flow-copy-source":"^1.0.1","jsdom":"^9.4.1","mocha":"^3.0.1","react":"^15.0.0","react-addons-test-utils":"^15.0.0","react-dom":"^15.0.0","sinon":"^1.17.3","watchify":"^3.7.0"},"dependencies":{"babel-runtime":"^6.11.6","kefir":"^3.5.1","kefir-bus":"^2.2.0"},"peerDependencies":{"react":"^0.14.7 || ^15.0.0"},"gitHead":"bb505fa8556ee6de778be7bbb0a401855cf87b25","_id":"@bodetree/react-smooth-collapse@1.2.0","_shasum":"7473a568e672a32c25a7420301c6d9abbd754c6e","_from":".","_npmVersion":"4.0.5","_nodeVersion":"7.4.0","_npmUser":{"name":"bjy","email":"bx.youngblood@gmail.com"},"dist":{"shasum":"7473a568e672a32c25a7420301c6d9abbd754c6e","tarball":"https://registry.npmjs.org/@bodetree/react-smooth-collapse/-/react-smooth-collapse-1.2.0.tgz","integrity":"sha512-ve3rze8TE36YiK8hHXN2w9E/eZSzfBn4pHnYmXKa3gafJk1dtcN1THPwC8xjRGCtp9a5pOhOc/4GTC5uV7I3/g==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDI7IP1ughwHYLZ9drWUPjwzy7JchjKcdtdsK4NFpkcaQIhAOZLk4wXalRqxMW0P6CbcYO40H2k5YACQVpRC6MpG13T"}]},"maintainers":[{"name":"bjy","email":"bx.youngblood@gmail.com"}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/react-smooth-collapse-1.2.0.tgz_1486056224317_0.05238146707415581"},"directories":{}}},"readme":"# react-smooth-collapse\n\n[![Circle CI](https://circleci.com/gh/StreakYC/react-smooth-collapse.svg?style=shield)](https://circleci.com/gh/StreakYC/react-smooth-collapse)\n[![npm version](https://badge.fury.io/js/react-smooth-collapse.svg)](https://badge.fury.io/js/react-smooth-collapse)\n\nThis component lets you animate the height of an element to reveal or hide its\ncontents. The animation automatically adjusts to the natural height of the\ncontents.\n\n![Example](https://streakyc.github.io/react-smooth-collapse/video/showhide.gif)\n\nAn example can be tried here:\n\nhttps://streakyc.github.io/react-smooth-collapse/example/\n\nYou can find its code in the `example` directory. The example may be compiled\nby running:\n\n```\nnpm install\nnpm run example-build\n```\n\nYou can build the example with live editing enabled (using\n[react-transform-hmr](https://github.com/gaearon/react-transform-hmr) and\n[browserify-hmr](https://github.com/AgentME/browserify-hmr)) by running:\n\n```\nnpm run example-watch\n```\n\n**Q:** Why would I use this when I could set a transition rule for height on an\nelement, and then change the height from \"auto\" to \"0\"?\n\n**A:** You can't animate from \"auto\". This component has the height set to\n\"auto\" while the element is expanded, and when the element is set to collapse,\nthe element's height is set to equal its current height, and then set to \"0\" so\nthat it animates shrinking correctly.\n\n**Q:** Couldn't I animate shrinking by setting a transition rule for\nmax-height, setting max-height to a very large value when the element is\nexpanded, and then set max-height to \"0\" when the element is collapsed?\n\n**A:** That won't animate with the given duration and won't fully respect your\ntiming function. For example, if you have an element that currently has a\nheight of 100px, a max-height of 10000px, and a transition rule of \"max-height\n1s linear\", then it will take 0.99 seconds before the element appears to start\nshrinking, and then it will fully shrink in 0.01 seconds. If you use a timing\nfunction like \"ease\" instead of \"linear\", then the easing will only be apparent\nwhile the element finishes shrinking to 0 or begins expanding from 0.\n\n## SmoothCollapse\n\nThis module exports the `SmoothCollapse` React component. The children of the\ncomponent should be the contents you want to show or hide. The component also\ntakes the following props:\n\n* `expanded` must be a boolean controlling whether to show the children.\n* `onChangeEnd` may be a function which will be called whenever a show or hide\n animation is completed.\n* `collapsedHeight` is the CSS height that the contents should have when\n collapsed. Defaults to \"0\".\n* `heightTransition` may be a string and is used for customizing the animation.\n This value is prefixed with \"height \" and is set as the CSS transition\n property of the SmoothCollapse element. This property defaults to \".25s ease\".\n\nIf the SmoothCollapse component starts out with expanded set to false and\ncollapsedHeight is 0, then the children are not rendered until the first time\nthe component is expanded. After the component has been expanded once, the\nchildren stay rendered so that they don't lose their state when they're hidden.\n\n## Types\n\n[Flow](http://flowtype.org/) type declarations for this module are included! As\nof Flow v0.22, you must add the following entries to your `.flowconfig` file's\noptions section for them to work:\n\n```\n[options]\nesproposal.class_static_fields=enable\nesproposal.class_instance_fields=enable\n```\n","maintainers":[{"email":"james.b.quigley93@gmail.com","name":"james.quigley"},{"email":"bx.youngblood@gmail.com","name":"bjy"}],"time":{"modified":"2022-06-12T15:24:02.563Z","created":"2017-02-02T17:23:46.107Z","1.2.0":"2017-02-02T17:23:46.107Z"},"homepage":"https://github.com/StreakYC/react-smooth-collapse#readme","keywords":["react","react-component","animation","hide","collapse"],"repository":{"type":"git","url":"git+https://github.com/StreakYC/react-smooth-collapse.git"},"author":{"name":"Chris Cowan","email":"agentme49@gmail.com"},"bugs":{"url":"https://github.com/StreakYC/react-smooth-collapse/issues"},"license":"MIT","readmeFilename":"README.md"}