react-card-flip
Advanced tools
Comparing version 1.1.5 to 1.1.6
@@ -15,3 +15,7 @@ "use strict"; | ||
if (k2 === undefined) k2 = k; | ||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); | ||
var desc = Object.getOwnPropertyDescriptor(m, k); | ||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
desc = { enumerable: true, get: function() { return m[k]; } }; | ||
} | ||
Object.defineProperty(o, k2, desc); | ||
}) : (function(o, m, k, k2) { | ||
@@ -29,3 +33,3 @@ if (k2 === undefined) k2 = k; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||
__setModuleDefault(result, mod); | ||
@@ -39,5 +43,5 @@ return result; | ||
var _a = props.cardStyles, back = _a.back, front = _a.front, cardZIndex = props.cardZIndex, containerStyle = props.containerStyle, containerClassName = props.containerClassName, flipDirection = props.flipDirection, flipSpeedFrontToBack = props.flipSpeedFrontToBack, flipSpeedBackToFront = props.flipSpeedBackToFront, infinite = props.infinite; | ||
var _b = react_1.useState(props.isFlipped), isFlipped = _b[0], setFlipped = _b[1]; | ||
var _c = react_1.useState(0), rotation = _c[0], setRotation = _c[1]; | ||
react_1.useEffect(function () { | ||
var _b = (0, react_1.useState)(props.isFlipped), isFlipped = _b[0], setFlipped = _b[1]; | ||
var _c = (0, react_1.useState)(0), rotation = _c[0], setRotation = _c[1]; | ||
(0, react_1.useEffect)(function () { | ||
if (props.isFlipped !== isFlipped) { | ||
@@ -48,6 +52,6 @@ setFlipped(props.isFlipped); | ||
}, [props.isFlipped]); | ||
var getContainerClassName = react_1.useMemo(function () { | ||
var getContainerClassName = (0, react_1.useMemo)(function () { | ||
var className = 'react-card-flip'; | ||
if (containerClassName) { | ||
className += " " + containerClassName; | ||
className += " ".concat(containerClassName); | ||
} | ||
@@ -62,11 +66,11 @@ return className; | ||
}; | ||
var frontRotateY = "rotateY(" + (infinite ? rotation : isFlipped ? 180 : 0) + "deg)"; | ||
var backRotateY = "rotateY(" + (infinite ? rotation + 180 : isFlipped ? 0 : -180) + "deg)"; | ||
var frontRotateX = "rotateX(" + (infinite ? rotation : isFlipped ? 180 : 0) + "deg)"; | ||
var backRotateX = "rotateX(" + (infinite ? rotation + 180 : isFlipped ? 0 : -180) + "deg)"; | ||
var frontRotateY = "rotateY(".concat(infinite ? rotation : isFlipped ? 180 : 0, "deg)"); | ||
var backRotateY = "rotateY(".concat(infinite ? rotation + 180 : isFlipped ? 0 : -180, "deg)"); | ||
var frontRotateX = "rotateX(".concat(infinite ? rotation : isFlipped ? 180 : 0, "deg)"); | ||
var backRotateX = "rotateX(".concat(infinite ? rotation + 180 : isFlipped ? 0 : -180, "deg)"); | ||
var styles = { | ||
back: __assign({ WebkitBackfaceVisibility: 'hidden', backfaceVisibility: 'hidden', height: '100%', left: '0', position: isFlipped ? 'relative' : 'absolute', top: '0', transform: flipDirection === 'horizontal' ? backRotateY : backRotateX, transformStyle: 'preserve-3d', transition: flipSpeedFrontToBack + "s", width: '100%' }, back), | ||
back: __assign({ WebkitBackfaceVisibility: 'hidden', backfaceVisibility: 'hidden', height: '100%', left: '0', position: isFlipped ? 'relative' : 'absolute', top: '0', transform: flipDirection === 'horizontal' ? backRotateY : backRotateX, transformStyle: 'preserve-3d', transition: "".concat(flipSpeedFrontToBack, "s"), width: '100%' }, back), | ||
container: { | ||
perspective: '1000px', | ||
zIndex: "" + cardZIndex, | ||
zIndex: "".concat(cardZIndex), | ||
}, | ||
@@ -78,3 +82,3 @@ flipper: { | ||
}, | ||
front: __assign({ WebkitBackfaceVisibility: 'hidden', backfaceVisibility: 'hidden', height: '100%', left: '0', position: isFlipped ? 'absolute' : 'relative', top: '0', transform: flipDirection === 'horizontal' ? frontRotateY : frontRotateX, transformStyle: 'preserve-3d', transition: flipSpeedBackToFront + "s", width: '100%', zIndex: '2' }, front), | ||
front: __assign({ WebkitBackfaceVisibility: 'hidden', backfaceVisibility: 'hidden', height: '100%', left: '0', position: isFlipped ? 'absolute' : 'relative', top: '0', transform: flipDirection === 'horizontal' ? frontRotateY : frontRotateX, transformStyle: 'preserve-3d', transition: "".concat(flipSpeedBackToFront, "s"), width: '100%', zIndex: '2' }, front), | ||
}; | ||
@@ -81,0 +85,0 @@ return (React.createElement("div", { className: getContainerClassName, style: __assign(__assign({}, styles.container), containerStyle) }, |
{ | ||
"name": "react-card-flip", | ||
"version": "1.1.5", | ||
"version": "1.1.6", | ||
"description": "ReactCardFlip", | ||
@@ -13,3 +13,3 @@ "main": "./lib/ReactCardFlip.js", | ||
"postbuild": "cp types/index.d.ts lib/ReactCardFlip.d.ts", | ||
"start": "npm run build-example && webpack-dev-server --progress --colors --config example/webpack.config.js", | ||
"start": "npm run build-example && webpack-dev-server --progress --config example/webpack.config.js", | ||
"test": "npm run build-e2e && jest", | ||
@@ -55,17 +55,18 @@ "test:coverage": "jest --coverage", | ||
"@wojtekmaj/enzyme-adapter-react-17": "^0.6.5", | ||
"babel-jest": "^26.1.0", | ||
"babel-loader": "^8.1.0", | ||
"babel-jest": "^29.1.2", | ||
"babel-loader": "^8.2.5", | ||
"coveralls": "^3.1.0", | ||
"enzyme": "^3.11.0", | ||
"file-loader": "^4.3.0", | ||
"jest": "^26.1.0", | ||
"file-loader": "^6.2.0", | ||
"jest": "^29.1.2", | ||
"jest-environment-jsdom": "^29.1.2", | ||
"puppeteer": "^1.11.0", | ||
"react": "^17.0.1", | ||
"react-dom": "^17.0.1", | ||
"ts-jest": "^26.1.3", | ||
"ts-jest": "^29.0.3", | ||
"tslint": "^5.20.1", | ||
"typescript": "^3.9.7", | ||
"webpack": "^4.43.0", | ||
"webpack-cli": "^3.3.12", | ||
"webpack-dev-server": "^3.11.0", | ||
"typescript": "^4.8.4", | ||
"webpack": "^5.74.0", | ||
"webpack-cli": "^4.10.0", | ||
"webpack-dev-server": "^4.11.1", | ||
"yargs": "^14.2.3" | ||
@@ -82,3 +83,6 @@ }, | ||
"verbose": true, | ||
"testURL": "http://localhost/", | ||
"testEnvironment": "jsdom", | ||
"testEnvironmentOptions": { | ||
"url": "http://localhost/" | ||
}, | ||
"setupFiles": [ | ||
@@ -85,0 +89,0 @@ "./tools/jest/jest.setup" |
15952
144
28