Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-cardstack

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-cardstack - npm Package Compare versions

Comparing version 1.0.1 to 1.1.0

dist/react-cardstack.min.js

19

dist/CardStack.js

@@ -31,4 +31,7 @@ "use strict";

_this = _React$Component.call(this, props) || this;
var childrenLength = props.children.length || 1;
var headerHeight = props.height / childrenLength;
var children = props.children,
height = props.height,
initialCard = props.initialCard;
var childrenLength = children.length || 1;
var headerHeight = height / childrenLength;
if (childrenLength <= 1) throw new Error(errorMessage);

@@ -47,2 +50,6 @@ _this.initialTopOffsets = props.children.map(function (child, i) {

_proto.componentWillMount = function componentWillMount() {
if (this.props.initialCard >= this.props.children.length) console.warn('prop "initialCard" cannot be equal or greater than children.length');else if (this.props.initialCard >= 0) this.handleCardClick(this.props.initialCard);
};
_proto.handleCardClick = function handleCardClick(id, cb) {

@@ -60,3 +67,3 @@ var _this2 = this;

return {
cardSelected: cardSelected ? false : true,
cardSelected: !cardSelected,
topOffsets: prev.topOffsets.concat([cardSelected ? _this2.initialTopOffsets[index] : newOffset])

@@ -115,3 +122,4 @@ };

hoverOffset: _propTypes.default.number,
width: _propTypes.default.number
width: _propTypes.default.number,
initialCard: _propTypes.default.number
};

@@ -122,5 +130,6 @@ CardStack.defaultProps = {

bgColor: 'f8f8f8',
hoverOffset: 30
hoverOffset: 30,
initialCard: -1
};
var _default = CardStack;
exports.default = _default;
{
"name": "react-cardstack",
"version": "1.0.1",
"version": "1.1.0",
"description": "react component inspired by the iOS passbook app UI",

@@ -22,3 +22,4 @@ "main": "dist/index.js",

"build:umd": "webpack",
"build:example": "webpack --config ./example/webpack.config.js --progress --colors"
"build:example": "webpack --config ./example/webpack.config.js --progress --colors",
"build:all": "yarn run build:compile && yarn run build:umd && yarn run build:example"
},

@@ -25,0 +26,0 @@ "files": [

@@ -68,2 +68,3 @@ React Card Stack

hoverOffset | number | 30px | how far the card will shift up when being hovered
initialCard | number | -1 | if provided, the card at i'th index will be initially visible

@@ -100,2 +101,2 @@ ### Card

MIT Licensed Copyright (c) Cameron Bourke 2016
MIT Licensed Copyright (c) Cameron Bourke 2018
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc