react-currency-input-field
Advanced tools
Comparing version 0.5.1 to 0.5.2
@@ -0,1 +1,9 @@ | ||
## [0.5.2](https://github.com/cchanxzy/react-currency-input-field/compare/v0.5.1...v0.5.2) (2019-12-01) | ||
### Bug Fixes | ||
* cursor jumping when modifying value ([db449d6](https://github.com/cchanxzy/react-currency-input-field/commit/db449d64dcaf1ba46c40d9cae7607bc229319d21)) | ||
* react is specified as external, and pattern allows float on mobile ([c011361](https://github.com/cchanxzy/react-currency-input-field/commit/c0113616adf83eb4d6edf3b3e9a2250a3ad37fc1)) | ||
## [0.5.1](https://github.com/cchanxzy/react-currency-input-field/compare/v0.5.0...v0.5.1) (2019-11-30) | ||
@@ -2,0 +10,0 @@ |
@@ -1,2 +0,2 @@ | ||
module.exports=function(e){var r={};function t(n){if(r[n])return r[n].exports;var u=r[n]={i:n,l:!1,exports:{}};return e[n].call(u.exports,u,u.exports,t),u.l=!0,u.exports}return t.m=e,t.c=r,t.d=function(e,r,n){t.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:n})},t.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},t.t=function(e,r){if(1&r&&(e=t(e)),8&r)return e;if(4&r&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(t.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&r&&"string"!=typeof e)for(var u in e)t.d(n,u,function(r){return e[r]}.bind(null,u));return n},t.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(r,"a",r),r},t.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},t.p="",t(t.s=0)}([function(e,r,t){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(r,"__esModule",{value:!0});var u=n(t(1));r.default=u.default},function(e,r,t){"use strict";var n=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var r={};if(null!=e)for(var t in e)Object.hasOwnProperty.call(e,t)&&(r[t]=e[t]);return r.default=e,r};Object.defineProperty(r,"__esModule",{value:!0});var u=n(t(2)),a=t(3);r.CurrencyInput=function(e){var r=e.allowDecimals,t=void 0===r||r,n=e.id,o=e.name,l=e.className,i=e.decimalsLimit,c=void 0===i?2:i,f=e.defaultValue,s=e.onChange,d=e.placeholder,p=e.prefix,m=u.useState(f?a.formatValue(String(f),p):""),v=m[0],b=m[1];return u.default.createElement("input",{type:"string",id:n,name:o,className:l,onChange:function(e){var r=e.target.value,n=a.cleanValue(r,t,c,p);if(!n)return s(null,o),b("");a.checkIsValidNumber(n)&&b(a.formatValue(n,p)),s(Number(n),o)},onFocus:function(){return v?v.length:0},placeholder:d,value:v,pattern:"[0-9]*"})},r.default=r.CurrencyInput},function(e,r){e.exports=require("react")},function(e,r,t){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.addCommas=function(e){return e.replace(/\B(?=(\d{3})+(?!\d))/g,",")},r.removeCommas=function(e){return e.replace(/,/g,"")},r.checkIsValidNumber=function(e){return!(Number(e)<0||isNaN(Number(e)))},r.cleanValue=function(e,t,n,u){var a=u?e.replace(u,""):e,o=r.removeCommas(a);if(o.includes(".")){var l=o.split("."),i=l[0],c=l[1];return""+i+(t?"."+(n?c.slice(0,n):c):"")}return o},r.formatValue=function(e,t){var n=e.split("."),u=n[0],a=n[1],o=t||"",l=e.includes(".")?"."+a:"";return""+o+r.addCommas(u)+l}}]); | ||
module.exports=function(e){var t={};function r(n){if(t[n])return t[n].exports;var u=t[n]={i:n,l:!1,exports:{}};return e[n].call(u.exports,u,u.exports,r),u.l=!0,u.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var u in e)r.d(n,u,function(t){return e[t]}.bind(null,u));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=0)}([function(e,t,r){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var u=n(r(1));t.default=u.default},function(e,t,r){"use strict";var n=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t};Object.defineProperty(t,"__esModule",{value:!0});var u=n(r(2)),a=r(3);t.CurrencyInput=function(e){var t=e.allowDecimals,r=void 0===t||t,n=e.id,o=e.name,l=e.className,i=e.decimalsLimit,c=void 0===i?2:i,f=e.defaultValue,s=e.onChange,d=e.placeholder,p=e.prefix,m=f?a.formatValue(String(f),p):"",v=u.useState(m),b=v[0],_=v[1],y=u.useState(0),g=y[0],h=y[1],O=u.useRef(null);return u.useEffect((function(){O&&O.current&&O.current.setSelectionRange(g,g)}),[g,O,b]),u.default.createElement("input",{type:"string",id:n,name:o,className:l,onChange:function(e){var t=e.target,n=t.selectionStart,u=t.value,l=a.cleanValue(u,r,c,p);if(!l)return s(null,o),_("");if(a.checkIsValidNumber(l)){var i=a.formatValue(l,p);if(n){var f=n+(i.length-u.length)||1;h(f)}_(i)}s(Number(l),o)},onFocus:function(){return b?b.length:0},placeholder:d,value:b,pattern:"[0-9]+([\\.,][0-9]+)?",ref:O})},t.default=t.CurrencyInput},function(e,t){e.exports=require("react")},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.addCommas=function(e){return e.replace(/\B(?=(\d{3})+(?!\d))/g,",")},t.removeCommas=function(e){return e.replace(/,/g,"")},t.checkIsValidNumber=function(e){return!(Number(e)<0||isNaN(Number(e)))},t.cleanValue=function(e,r,n,u){var a=u?e.replace(u,""):e,o=t.removeCommas(a);if(o.includes(".")){var l=o.split("."),i=l[0],c=l[1];return""+i+(r?"."+(n?c.slice(0,n):c):"")}return o},t.formatValue=function(e,r){var n=e.split("."),u=n[0],a=n[1],o=r||"",l=e.includes(".")?"."+a:"";return""+o+t.addCommas(u)+l}}]); | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "react-currency-input-field", | ||
"version": "0.5.1", | ||
"version": "0.5.2", | ||
"description": "React input field component for currency and numbers", | ||
@@ -83,3 +83,3 @@ "files": [ | ||
"jest": { | ||
"verbose": true, | ||
"verbose": false, | ||
"collectCoverage": true, | ||
@@ -86,0 +86,0 @@ "setupFilesAfterEnv": [ |
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
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
23410
0