styled-spinkit
Advanced tools
Comparing version 0.3.0 to 0.4.0
@@ -132,4 +132,4 @@ import styled, { css, keyframes } from 'styled-components'; | ||
function round(fn, val, precision) { | ||
if (typeof val !== 'number') { | ||
function round(method, input, precision) { | ||
if (typeof input !== 'number') { | ||
throw new TypeError('Expected value to be a number'); | ||
@@ -142,11 +142,25 @@ } | ||
var exponent = precision > 0 ? 'e' : 'e-'; | ||
var exponentNeg = precision > 0 ? 'e-' : 'e'; | ||
precision = Math.abs(precision); | ||
var isRoundingAndNegative = method === 'round' && input < 0; | ||
if (isRoundingAndNegative) { | ||
input = Math.abs(input); | ||
} | ||
if (fn === 'round') { | ||
return Number(Math.sign(val) * (Math.round(Math.abs(val) + exponent + precision) + exponentNeg + precision)); | ||
var _$split = (input + 'e').split('e'), | ||
number = _$split[0], | ||
exponent = _$split[1]; | ||
var ret = Math[method](number + 'e' + (Number(exponent) + precision)); | ||
var _$split2 = (ret + 'e').split('e'); | ||
number = _$split2[0]; | ||
exponent = _$split2[1]; | ||
ret = Number(number + 'e' + (Number(exponent) - precision)); | ||
if (isRoundingAndNegative) { | ||
ret = -ret; | ||
} | ||
return Number(Math[fn](val + exponent + precision) + exponentNeg + precision); | ||
return ret; | ||
} | ||
@@ -153,0 +167,0 @@ |
@@ -39,5 +39,5 @@ 'use strict'; | ||
ChangeDots.propTypes = { | ||
size: _propTypes2.default.number.isRequired, | ||
color: _propTypes2.default.string.isRequired | ||
size: _propTypes2.default.number, | ||
color: _propTypes2.default.string | ||
}; | ||
exports.default = ChangeDots; |
@@ -53,5 +53,5 @@ 'use strict'; | ||
Circle.propTypes = { | ||
size: _propTypes2.default.number.isRequired, | ||
color: _propTypes2.default.string.isRequired | ||
size: _propTypes2.default.number, | ||
color: _propTypes2.default.string | ||
}; | ||
exports.default = Circle; |
@@ -43,5 +43,5 @@ 'use strict'; | ||
CubeGrid.propTypes = { | ||
size: _propTypes2.default.number.isRequired, | ||
color: _propTypes2.default.string.isRequired | ||
size: _propTypes2.default.number, | ||
color: _propTypes2.default.string | ||
}; | ||
exports.default = CubeGrid; |
@@ -39,5 +39,5 @@ 'use strict'; | ||
DoubleBounce.propTypes = { | ||
size: _propTypes2.default.number.isRequired, | ||
color: _propTypes2.default.string.isRequired | ||
size: _propTypes2.default.number, | ||
color: _propTypes2.default.string | ||
}; | ||
exports.default = DoubleBounce; |
@@ -52,5 +52,5 @@ 'use strict'; | ||
ForldingCircle.propTypes = { | ||
size: _propTypes2.default.number.isRequired, | ||
color: _propTypes2.default.string.isRequired | ||
size: _propTypes2.default.number, | ||
color: _propTypes2.default.string | ||
}; | ||
exports.default = ForldingCircle; |
@@ -51,5 +51,5 @@ 'use strict'; | ||
FoldingCube.propTypes = { | ||
size: _propTypes2.default.number.isRequired, | ||
color: _propTypes2.default.string.isRequired | ||
size: _propTypes2.default.number, | ||
color: _propTypes2.default.string | ||
}; | ||
exports.default = FoldingCube; |
@@ -36,5 +36,5 @@ 'use strict'; | ||
Pulse.propTypes = { | ||
size: _propTypes2.default.number.isRequired, | ||
color: _propTypes2.default.string.isRequired | ||
size: _propTypes2.default.number, | ||
color: _propTypes2.default.string | ||
}; | ||
exports.default = Pulse; |
@@ -40,5 +40,5 @@ 'use strict'; | ||
RotaingPlain.propTypes = { | ||
size: _propTypes2.default.number.isRequired, | ||
color: _propTypes2.default.string.isRequired | ||
size: _propTypes2.default.number, | ||
color: _propTypes2.default.string | ||
}; | ||
exports.default = RotaingPlain; |
@@ -40,5 +40,5 @@ 'use strict'; | ||
ThreeBounce.propTypes = { | ||
size: _propTypes2.default.number.isRequired, | ||
color: _propTypes2.default.string.isRequired | ||
size: _propTypes2.default.number, | ||
color: _propTypes2.default.string | ||
}; | ||
exports.default = ThreeBounce; |
@@ -48,5 +48,5 @@ 'use strict'; | ||
WanderingCubes.propTypes = { | ||
size: _propTypes2.default.number.isRequired, | ||
color: _propTypes2.default.string.isRequired | ||
size: _propTypes2.default.number, | ||
color: _propTypes2.default.string | ||
}; | ||
exports.default = WanderingCubes; |
@@ -55,5 +55,5 @@ 'use strict'; | ||
Wave.propTypes = { | ||
size: _propTypes2.default.number.isRequired, | ||
color: _propTypes2.default.string.isRequired | ||
size: _propTypes2.default.number, | ||
color: _propTypes2.default.string | ||
}; | ||
exports.default = Wave; |
{ | ||
"name": "styled-spinkit", | ||
"version": "0.3.0", | ||
"version": "0.4.0", | ||
"description": "Spinner Loading components", | ||
@@ -57,4 +57,4 @@ "license": "MIT", | ||
"dependencies": { | ||
"prop-types": "^15.6.0", | ||
"round-to": "^2.0.0", | ||
"prop-types": "^15.6.1", | ||
"round-to": "^3.0.0", | ||
"styled-components": "^2.4.0" | ||
@@ -64,40 +64,40 @@ }, | ||
"@kadira/storybook-deployer": "^1.2.0", | ||
"@storybook/addon-actions": "^3.3.11", | ||
"@storybook/addon-info": "^3.3.11", | ||
"@storybook/addon-knobs": "^3.3.11", | ||
"@storybook/addon-storyshots": "^3.3.15", | ||
"@storybook/react": "^3.3.15", | ||
"all-contributors-cli": "^4.11.0", | ||
"@storybook/addon-actions": "^3.4.6", | ||
"@storybook/addon-info": "^3.4.6", | ||
"@storybook/addon-knobs": "^3.4.6", | ||
"@storybook/addon-storyshots": "^3.4.6", | ||
"@storybook/react": "^3.4.6", | ||
"all-contributors-cli": "^4.11.2", | ||
"babel-cli": "^6.26.0", | ||
"babel-core": "^6.26.0", | ||
"babel-jest": "^22.4.1", | ||
"babel-core": "^6.26.3", | ||
"babel-jest": "^23.0.1", | ||
"babel-plugin-external-helpers": "^6.22.0", | ||
"babel-plugin-flow-react-proptypes": "^21.0.0", | ||
"babel-plugin-flow-react-proptypes": "^24.0.1", | ||
"babel-plugin-styled-components": "^1.5.1", | ||
"babel-preset-zero": "^0.1.0", | ||
"babel-preset-zero": "^0.2.0", | ||
"enzyme": "^3.3.0", | ||
"enzyme-adapter-react-16": "^1.1.1", | ||
"enzyme-to-json": "^3.3.1", | ||
"eslint": "^4.18.2", | ||
"eslint-config-precure": "^2.6.0", | ||
"flow-bin": "^0.67.1", | ||
"flow-copy-source": "^1.3.0", | ||
"enzyme-to-json": "^3.3.4", | ||
"eslint": "^4.19.1", | ||
"eslint-config-precure": "^2.7.0", | ||
"flow-bin": "^0.73.0", | ||
"flow-copy-source": "^2.0.0", | ||
"husky": "^0.14.3", | ||
"jest": "^22.4.2", | ||
"jest-styled-components": "5.0.0", | ||
"lint-staged": "^7.0.0", | ||
"prettier": "^1.11.1", | ||
"react": "^16.2.0", | ||
"react-dom": "^16.2.0", | ||
"jest": "^23.1.0", | ||
"jest-styled-components": "5.0.1", | ||
"lint-staged": "^7.1.3", | ||
"prettier": "^1.13.4", | ||
"react": "^16.4.0", | ||
"react-dom": "^16.4.0", | ||
"rimraf": "^2.6.2", | ||
"rollup": "^0.56.5", | ||
"rollup-plugin-babel": "^3.0.3", | ||
"rollup-plugin-commonjs": "^9.0.0", | ||
"rollup": "^0.59.4", | ||
"rollup-plugin-babel": "^3.0.4", | ||
"rollup-plugin-commonjs": "^9.1.3", | ||
"rollup-plugin-flow": "^1.1.1", | ||
"rollup-plugin-node-resolve": "^3.2.0", | ||
"rollup-plugin-node-resolve": "^3.3.0", | ||
"storyshots": "^3.2.2", | ||
"stylelint": "^9.1.1", | ||
"stylelint": "^9.2.1", | ||
"stylelint-config-standard": "^18.2.0", | ||
"stylelint-config-styled-components": "^0.1.1", | ||
"stylelint-processor-styled-components": "^1.3.0" | ||
"stylelint-processor-styled-components": "^1.3.1" | ||
}, | ||
@@ -104,0 +104,0 @@ "peerDependencies": { |
@@ -33,13 +33,13 @@ # styled-spinkit | ||
* `<ChasingDots/>` | ||
* `<Circle/>` | ||
* `<CubeGrid/>` | ||
* `<Pulse/>` | ||
* `<FadingCircle/>` | ||
* `<ThreeBounce/>` | ||
* `<FoldingCube/>` | ||
* `<WanderingCubes/>` | ||
* `<WaveLoading/>` | ||
* `<DoubleBounce/>` | ||
* `<RotaingPlane/>` | ||
- `<ChasingDots/>` | ||
- `<Circle/>` | ||
- `<CubeGrid/>` | ||
- `<Pulse/>` | ||
- `<FadingCircle/>` | ||
- `<ThreeBounce/>` | ||
- `<FoldingCube/>` | ||
- `<WanderingCubes/>` | ||
- `<WaveLoading/>` | ||
- `<DoubleBounce/>` | ||
- `<RotaingPlane/>` | ||
@@ -46,0 +46,0 @@ #### Props |
@@ -25,4 +25,4 @@ // @flow | ||
const circles = getRange(count).map(k => { | ||
const transform = roundTo(360 / count * (k + 1), 1) | ||
const delay = roundTo(-speed + speed / count * k, 1) | ||
const transform = roundTo((360 / count) * (k + 1), 1) | ||
const delay = roundTo(-speed + (speed / count) * k, 1) | ||
return <Child key={delay} delay={delay} transform={transform} /> | ||
@@ -29,0 +29,0 @@ }) |
@@ -26,4 +26,4 @@ // @flow | ||
key={v} | ||
rotate={roundTo(360 / count * v, 1)} | ||
delay={roundTo(range - range / count * v, 2)} | ||
rotate={roundTo((360 / count) * v, 1)} | ||
delay={roundTo(range - (range / count) * v, 2)} | ||
/> | ||
@@ -30,0 +30,0 @@ )) |
@@ -28,3 +28,3 @@ // @flow | ||
key={v} | ||
delay={roundTo(range / cubeCount * v, 2)} | ||
delay={roundTo((range / cubeCount) * v, 2)} | ||
duration={duration} | ||
@@ -31,0 +31,0 @@ /> |
@@ -27,3 +27,3 @@ // @flow | ||
<Rect | ||
delay={roundTo(-speed + delayRange / (rectCount - 1) * v, 1)} | ||
delay={roundTo(-speed + (delayRange / (rectCount - 1)) * v, 1)} | ||
key={v} | ||
@@ -30,0 +30,0 @@ /> |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
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
3015
159059
+ Addedround-to@3.0.0(transitive)
- Removedround-to@2.0.0(transitive)
Updatedprop-types@^15.6.1
Updatedround-to@^3.0.0