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

react-currency-input-field

Package Overview
Dependencies
Maintainers
1
Versions
105
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-currency-input-field - npm Package Compare versions

Comparing version 2.6.0 to 2.7.0

7

CHANGELOG.md

@@ -0,1 +1,8 @@

# [2.7.0](https://github.com/cchanxzy/react-currency-input-field/compare/v2.6.0...v2.7.0) (2020-11-18)
### Features
* can turn off abbreviations ([67a54c1](https://github.com/cchanxzy/react-currency-input-field/commit/67a54c1288d0fded0fed1f4ef751073eb44a73cb))
# [2.6.0](https://github.com/cchanxzy/react-currency-input-field/compare/v2.5.0...v2.6.0) (2020-11-15)

@@ -2,0 +9,0 @@

@@ -92,3 +92,9 @@ /// <reference types="react" />

turnOffSeparators?: boolean;
/**
* Disable abbreviations eg. 1k > 1,000, 2m > 2,000,000
*
* Default = false
*/
turnOffAbbreviations?: boolean;
}>;
export {};

6

dist/components/utils/cleanValue.d.ts

@@ -1,2 +0,2 @@

declare type Props = {
export declare type CleanValueOptions = {
value: string;

@@ -8,2 +8,3 @@ decimalSeparator?: string;

allowNegativeValue?: boolean;
turnOffAbbreviations?: boolean;
prefix?: string;

@@ -14,3 +15,2 @@ };

*/
export declare const cleanValue: ({ value, groupSeparator, decimalSeparator, allowDecimals, decimalsLimit, allowNegativeValue, prefix, }: Props) => string;
export {};
export declare const cleanValue: ({ value, groupSeparator, decimalSeparator, allowDecimals, decimalsLimit, allowNegativeValue, turnOffAbbreviations, prefix, }: CleanValueOptions) => string;

@@ -1,2 +0,2 @@

module.exports=function(e){var r={};function t(a){if(r[a])return r[a].exports;var n=r[a]={i:a,l:!1,exports:{}};return e[a].call(n.exports,n,n.exports,t),n.l=!0,n.exports}return t.m=e,t.c=r,t.d=function(e,r,a){t.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:a})},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 a=Object.create(null);if(t.r(a),Object.defineProperty(a,"default",{enumerable:!0,value:e}),2&r&&"string"!=typeof e)for(var n in e)t.d(a,n,function(r){return e[r]}.bind(null,n));return a},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=2)}([function(e,r,t){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.escapeRegExp=void 0,r.escapeRegExp=function(e){return e.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")}},function(e,r,t){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.formatValue=void 0;var a=t(11);r.formatValue=function(e){var r=e.value,t=e.groupSeparator,n=void 0===t?",":t,i=e.decimalSeparator,o=void 0===i?".":i,u=e.turnOffSeparators,l=void 0!==u&&u,c=e.prefix;if(""===r||void 0===r)return"";var d=String(r);if("-"===d)return"-";var f=RegExp("^-\\d+").test(d),s=o&&d.includes(o),p=f?d.replace("-",""):d,v=s?p.split(o):[p],m=v[0],b=v[1];return""+(f?"-":"")+(c||"")+(l?m:a.addSeparators(m,n))+(s&&b?""+o+b:s?""+o:"")}},function(e,r,t){"use strict";var a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(r,"__esModule",{value:!0});var n=a(t(3));r.default=n.default;var i=t(1);Object.defineProperty(r,"formatValue",{enumerable:!0,get:function(){return i.formatValue}})},function(e,r,t){"use strict";var a=this&&this.__assign||function(){return(a=Object.assign||function(e){for(var r,t=1,a=arguments.length;t<a;t++)for(var n in r=arguments[t])Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n]);return e}).apply(this,arguments)},n=this&&this.__createBinding||(Object.create?function(e,r,t,a){void 0===a&&(a=t),Object.defineProperty(e,a,{enumerable:!0,get:function(){return r[t]}})}:function(e,r,t,a){void 0===a&&(a=t),e[a]=r[t]}),i=this&&this.__setModuleDefault||(Object.create?function(e,r){Object.defineProperty(e,"default",{enumerable:!0,value:r})}:function(e,r){e.default=r}),o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var r={};if(null!=e)for(var t in e)"default"!==t&&Object.hasOwnProperty.call(e,t)&&n(r,e,t);return i(r,e),r},u=this&&this.__rest||function(e,r){var t={};for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&r.indexOf(a)<0&&(t[a]=e[a]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(a=Object.getOwnPropertySymbols(e);n<a.length;n++)r.indexOf(a[n])<0&&Object.prototype.propertyIsEnumerable.call(e,a[n])&&(t[a[n]]=e[a[n]])}return t};Object.defineProperty(r,"__esModule",{value:!0}),r.CurrencyInput=void 0;var l=o(t(4)),c=t(5);r.CurrencyInput=function(e){var r=e.allowDecimals,t=void 0===r||r,n=e.allowNegativeValue,i=void 0===n||n,o=e.id,d=e.name,f=e.className,s=e.decimalsLimit,p=e.defaultValue,v=e.disabled,m=void 0!==v&&v,b=e.maxLength,g=e.value,h=e.onChange,_=e.onBlurValue,y=e.fixedDecimalLength,O=e.placeholder,S=e.precision,x=e.prefix,j=e.step,w=e.decimalSeparator,V=void 0===w?".":w,P=e.groupSeparator,M=void 0===P?",":P,E=e.turnOffSeparators,R=void 0!==E&&E,N=u(e,["allowDecimals","allowNegativeValue","id","name","className","decimalsLimit","defaultValue","disabled","maxLength","value","onChange","onBlurValue","fixedDecimalLength","placeholder","precision","prefix","step","decimalSeparator","groupSeparator","turnOffSeparators"]);if(V===M)throw new Error("decimalSeparator cannot be the same as groupSeparator");if(c.isNumber(V))throw new Error("decimalSeparator cannot be a number");if(c.isNumber(M))throw new Error("groupSeparator cannot be a number");var D={decimalSeparator:V,groupSeparator:M,turnOffSeparators:R,prefix:x},C={decimalSeparator:V,groupSeparator:M,allowDecimals:t,decimalsLimit:s||y||2,allowNegativeValue:i,prefix:x},L=void 0!==p?c.formatValue(a({value:String(p)},D)):"",I=l.useState(L),A=I[0],B=I[1],T=l.useState(0),k=T[0],$=T[1],U=l.useRef(null),q=function(e,r){var t=c.cleanValue(a({value:e},C));if(!t)return h&&h(void 0,d),void B("");if(!(b&&t.replace(/-/g,"").length>b)){if("-"===t)return h&&h(void 0,d),void B(e);var n=c.formatValue(a({value:t},D));if(null!=r){var i=r+(n.length-e.length)||1;$(i)}B(n),h&&h(t,d)}};l.useEffect((function(){U&&U.current&&U.current.setSelectionRange(k,k)}),[k,U]);var F=void 0!==g?c.formatValue(a({value:String(g)},D)):void 0;return l.default.createElement("input",a({type:"text",inputMode:"decimal",id:o,name:d,className:f,onChange:function(e){var r=e.target,t=r.value,a=r.selectionStart;q(t,a)},onBlur:function(e){var r=e.target.value,t=c.cleanValue(a({value:r},C));if("-"===t||!t)return _&&_(void 0,d),void B("");var n=c.fixedDecimalValue(t,V,y),i=c.padTrimValue(n,V,S||y);h&&h(i,d),_&&_(i,d);var o=c.formatValue(a({value:i},D));B(o)},onFocus:function(){return A?A.length:0},onKeyDown:function(e){var r=e.key;if(j&&("ArrowUp"===r||"ArrowDown"===r)){var t=Number(void 0!==g?g:c.cleanValue(a({value:A},C)))||0,n=String("ArrowUp"===r?t+Number(j):t-Number(j));q(n)}},placeholder:O,disabled:m,value:void 0!==F&&"-"!==A?F:A,ref:U},N))},r.default=r.CurrencyInput},function(e,r){e.exports=require("react")},function(e,r,t){"use strict";var a=this&&this.__createBinding||(Object.create?function(e,r,t,a){void 0===a&&(a=t),Object.defineProperty(e,a,{enumerable:!0,get:function(){return r[t]}})}:function(e,r,t,a){void 0===a&&(a=t),e[a]=r[t]}),n=this&&this.__exportStar||function(e,r){for(var t in e)"default"===t||r.hasOwnProperty(t)||a(r,e,t)};Object.defineProperty(r,"__esModule",{value:!0}),n(t(6),r),n(t(10),r),n(t(1),r),n(t(12),r),n(t(13),r)},function(e,r,t){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.cleanValue=void 0;var a=t(7),n=t(8),i=t(9),o=t(0);r.cleanValue=function(e){var r=e.value,t=e.groupSeparator,u=void 0===t?",":t,l=e.decimalSeparator,c=void 0===l?".":l,d=e.allowDecimals,f=void 0===d||d,s=e.decimalsLimit,p=void 0===s?2:s,v=e.allowNegativeValue,m=void 0===v||v,b=e.prefix,g=void 0===b?"":b,h=r.includes("-"),_=RegExp("(\\d+)-?"+o.escapeRegExp(g)).exec(r)||[],y=_[0],O=_[1],S=g?r.replace(y,"").concat(O):r,x=n.removeSeparators(S,u),j=i.removeInvalidChars(x,[u,c,"k","m","b"]),w=a.parseAbbrValue(j,c)||j,V=h&&m?"-":"";if(String(w).includes(c)){var P=j.split(c),M=P[0],E=P[1],R=p?E.slice(0,p):E;return""+V+M+(f?""+c+R:"")}return""+V+w}},function(e,r,t){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.parseAbbrValue=r.abbrValue=void 0;var a=t(0);r.abbrValue=function(e,r,t){if(void 0===r&&(r="."),void 0===t&&(t=10),e>999){var a=(""+e).length,n=Math.pow,i=n(10,t);return a-=a%3,(Math.round(e*i/n(10,a))/i+" kMGTPE"[a/3]).replace(".",r)}return String(e)};var n={k:1e3,m:1e6,b:1e9};r.parseAbbrValue=function(e,r){void 0===r&&(r=".");var t=new RegExp("(\\d+("+a.escapeRegExp(r)+"\\d+)?)([kmb])$","i"),i=e.match(t);if(i){var o=i[1],u=i[3],l=u?n[u.toLowerCase()]:null;if(o&&l)return Number(o.replace(r,"."))*l}}},function(e,r,t){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.removeSeparators=void 0;var a=t(0);r.removeSeparators=function(e,r){void 0===r&&(r=",");var t=new RegExp(a.escapeRegExp(r),"g");return e.replace(t,"")}},function(e,r,t){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.removeInvalidChars=void 0;var a=t(0);r.removeInvalidChars=function(e,r){var t=a.escapeRegExp(r.join("")),n=new RegExp("[^\\d"+t+"]","gi");return e.replace(n,"")}},function(e,r,t){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.fixedDecimalValue=void 0,r.fixedDecimalValue=function(e,r,t){if(t&&e.length>1){if(e.includes(r)){var a=e.split(r),n=a[0];if((i=a[1]).length>t)return""+n+r+i.slice(0,t)}var i,o=e.length>t?new RegExp("(\\d+)(\\d{"+t+"})"):new RegExp("(\\d)(\\d+)"),u=e.match(o);if(u)return""+(n=u[1])+r+(i=u[2])}return e}},function(e,r,t){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.addSeparators=void 0,r.addSeparators=function(e,r){return void 0===r&&(r=","),e.replace(/\B(?=(\d{3})+(?!\d))/g,r)}},function(e,r,t){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.isNumber=void 0,r.isNumber=function(e){return RegExp(/\d/,"gi").test(e)}},function(e,r,t){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.padTrimValue=void 0,r.padTrimValue=function(e,r,t){if(void 0===r&&(r="."),!t||""===e||void 0===e)return e;if(!e.match(/\d/g))return"";var a=e.split(r),n=a[0],i=a[1]||"";if(i.length<t)for(;i.length<t;)i+="0";else i=i.slice(0,t);return""+n+r+i}}]);
module.exports=function(e){var r={};function t(a){if(r[a])return r[a].exports;var n=r[a]={i:a,l:!1,exports:{}};return e[a].call(n.exports,n,n.exports,t),n.l=!0,n.exports}return t.m=e,t.c=r,t.d=function(e,r,a){t.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:a})},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 a=Object.create(null);if(t.r(a),Object.defineProperty(a,"default",{enumerable:!0,value:e}),2&r&&"string"!=typeof e)for(var n in e)t.d(a,n,function(r){return e[r]}.bind(null,n));return a},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=2)}([function(e,r,t){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.escapeRegExp=void 0,r.escapeRegExp=function(e){return e.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")}},function(e,r,t){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.formatValue=void 0;var a=t(11);r.formatValue=function(e){var r=e.value,t=e.groupSeparator,n=void 0===t?",":t,i=e.decimalSeparator,o=void 0===i?".":i,u=e.turnOffSeparators,l=void 0!==u&&u,c=e.prefix;if(""===r||void 0===r)return"";var f=String(r);if("-"===f)return"-";var d=RegExp("^-\\d+").test(f),s=o&&f.includes(o),v=d?f.replace("-",""):f,p=s?v.split(o):[v],m=p[0],b=p[1];return""+(d?"-":"")+(c||"")+(l?m:a.addSeparators(m,n))+(s&&b?""+o+b:s?""+o:"")}},function(e,r,t){"use strict";var a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(r,"__esModule",{value:!0});var n=a(t(3));r.default=n.default;var i=t(1);Object.defineProperty(r,"formatValue",{enumerable:!0,get:function(){return i.formatValue}})},function(e,r,t){"use strict";var a=this&&this.__assign||function(){return(a=Object.assign||function(e){for(var r,t=1,a=arguments.length;t<a;t++)for(var n in r=arguments[t])Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n]);return e}).apply(this,arguments)},n=this&&this.__createBinding||(Object.create?function(e,r,t,a){void 0===a&&(a=t),Object.defineProperty(e,a,{enumerable:!0,get:function(){return r[t]}})}:function(e,r,t,a){void 0===a&&(a=t),e[a]=r[t]}),i=this&&this.__setModuleDefault||(Object.create?function(e,r){Object.defineProperty(e,"default",{enumerable:!0,value:r})}:function(e,r){e.default=r}),o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var r={};if(null!=e)for(var t in e)"default"!==t&&Object.hasOwnProperty.call(e,t)&&n(r,e,t);return i(r,e),r},u=this&&this.__rest||function(e,r){var t={};for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&r.indexOf(a)<0&&(t[a]=e[a]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(a=Object.getOwnPropertySymbols(e);n<a.length;n++)r.indexOf(a[n])<0&&Object.prototype.propertyIsEnumerable.call(e,a[n])&&(t[a[n]]=e[a[n]])}return t};Object.defineProperty(r,"__esModule",{value:!0}),r.CurrencyInput=void 0;var l=o(t(4)),c=t(5);r.CurrencyInput=function(e){var r=e.allowDecimals,t=void 0===r||r,n=e.allowNegativeValue,i=void 0===n||n,o=e.id,f=e.name,d=e.className,s=e.decimalsLimit,v=e.defaultValue,p=e.disabled,m=void 0!==p&&p,b=e.maxLength,g=e.value,h=e.onChange,_=e.onBlurValue,y=e.fixedDecimalLength,O=e.placeholder,S=e.precision,x=e.prefix,j=e.step,w=e.decimalSeparator,V=void 0===w?".":w,P=e.groupSeparator,M=void 0===P?",":P,E=e.turnOffSeparators,R=void 0!==E&&E,N=e.turnOffAbbreviations,D=void 0!==N&&N,A=u(e,["allowDecimals","allowNegativeValue","id","name","className","decimalsLimit","defaultValue","disabled","maxLength","value","onChange","onBlurValue","fixedDecimalLength","placeholder","precision","prefix","step","decimalSeparator","groupSeparator","turnOffSeparators","turnOffAbbreviations"]);if(V===M)throw new Error("decimalSeparator cannot be the same as groupSeparator");if(c.isNumber(V))throw new Error("decimalSeparator cannot be a number");if(c.isNumber(M))throw new Error("groupSeparator cannot be a number");var C={decimalSeparator:V,groupSeparator:M,turnOffSeparators:R,prefix:x},L={decimalSeparator:V,groupSeparator:M,allowDecimals:t,decimalsLimit:s||y||2,allowNegativeValue:i,turnOffAbbreviations:D,prefix:x},I=void 0!==v?c.formatValue(a({value:String(v)},C)):"",B=l.useState(I),T=B[0],k=B[1],$=l.useState(0),U=$[0],q=$[1],F=l.useRef(null),G=function(e,r){var t=c.cleanValue(a({value:e},L));if(!t)return h&&h(void 0,f),void k("");if(!(b&&t.replace(/-/g,"").length>b)){if("-"===t)return h&&h(void 0,f),void k(e);var n=c.formatValue(a({value:t},C));if(null!=r){var i=r+(n.length-e.length)||1;q(i)}k(n),h&&h(t,f)}};l.useEffect((function(){F&&F.current&&F.current.setSelectionRange(U,U)}),[U,F]);var K=void 0!==g?c.formatValue(a({value:String(g)},C)):void 0;return l.default.createElement("input",a({type:"text",inputMode:"decimal",id:o,name:f,className:d,onChange:function(e){var r=e.target,t=r.value,a=r.selectionStart;G(t,a)},onBlur:function(e){var r=e.target.value,t=c.cleanValue(a({value:r},L));if("-"===t||!t)return _&&_(void 0,f),void k("");var n=c.fixedDecimalValue(t,V,y),i=c.padTrimValue(n,V,S||y);h&&h(i,f),_&&_(i,f);var o=c.formatValue(a({value:i},C));k(o)},onFocus:function(){return T?T.length:0},onKeyDown:function(e){var r=e.key;if(j&&("ArrowUp"===r||"ArrowDown"===r)){var t=Number(void 0!==g?g:c.cleanValue(a({value:T},L)))||0,n=String("ArrowUp"===r?t+Number(j):t-Number(j));G(n)}},placeholder:O,disabled:m,value:void 0!==K&&"-"!==T?K:T,ref:F},A))},r.default=r.CurrencyInput},function(e,r){e.exports=require("react")},function(e,r,t){"use strict";var a=this&&this.__createBinding||(Object.create?function(e,r,t,a){void 0===a&&(a=t),Object.defineProperty(e,a,{enumerable:!0,get:function(){return r[t]}})}:function(e,r,t,a){void 0===a&&(a=t),e[a]=r[t]}),n=this&&this.__exportStar||function(e,r){for(var t in e)"default"===t||r.hasOwnProperty(t)||a(r,e,t)};Object.defineProperty(r,"__esModule",{value:!0}),n(t(6),r),n(t(10),r),n(t(1),r),n(t(12),r),n(t(13),r)},function(e,r,t){"use strict";var a=this&&this.__spreadArrays||function(){for(var e=0,r=0,t=arguments.length;r<t;r++)e+=arguments[r].length;var a=Array(e),n=0;for(r=0;r<t;r++)for(var i=arguments[r],o=0,u=i.length;o<u;o++,n++)a[n]=i[o];return a};Object.defineProperty(r,"__esModule",{value:!0}),r.cleanValue=void 0;var n=t(7),i=t(8),o=t(9),u=t(0);r.cleanValue=function(e){var r=e.value,t=e.groupSeparator,l=void 0===t?",":t,c=e.decimalSeparator,f=void 0===c?".":c,d=e.allowDecimals,s=void 0===d||d,v=e.decimalsLimit,p=void 0===v?2:v,m=e.allowNegativeValue,b=void 0===m||m,g=e.turnOffAbbreviations,h=void 0!==g&&g,_=e.prefix,y=void 0===_?"":_,O=h?[]:["k","m","b"],S=r.includes("-"),x=RegExp("(\\d+)-?"+u.escapeRegExp(y)).exec(r)||[],j=x[0],w=x[1],V=y?r.replace(j,"").concat(w):r,P=i.removeSeparators(V,l),M=o.removeInvalidChars(P,a([l,f],O)),E=M;if(!h){if(O.some((function(e){return e===M.toLowerCase()})))return"";var R=n.parseAbbrValue(M,f);R&&(E=String(R))}var N=S&&b?"-":"";if(String(E).includes(f)){var D=M.split(f),A=D[0],C=D[1],L=p?C.slice(0,p):C;return""+N+A+(s?""+f+L:"")}return""+N+E}},function(e,r,t){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.parseAbbrValue=r.abbrValue=void 0;var a=t(0);r.abbrValue=function(e,r,t){if(void 0===r&&(r="."),void 0===t&&(t=10),e>999){var a=(""+e).length,n=Math.pow,i=n(10,t);return a-=a%3,(Math.round(e*i/n(10,a))/i+" kMGTPE"[a/3]).replace(".",r)}return String(e)};var n={k:1e3,m:1e6,b:1e9};r.parseAbbrValue=function(e,r){void 0===r&&(r=".");var t=new RegExp("(\\d+("+a.escapeRegExp(r)+"\\d+)?)([kmb])$","i"),i=e.match(t);if(i){var o=i[1],u=i[3],l=n[u.toLowerCase()];if(o&&l)return Number(o.replace(r,"."))*l}}},function(e,r,t){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.removeSeparators=void 0;var a=t(0);r.removeSeparators=function(e,r){void 0===r&&(r=",");var t=new RegExp(a.escapeRegExp(r),"g");return e.replace(t,"")}},function(e,r,t){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.removeInvalidChars=void 0;var a=t(0);r.removeInvalidChars=function(e,r){var t=a.escapeRegExp(r.join("")),n=new RegExp("[^\\d"+t+"]","gi");return e.replace(n,"")}},function(e,r,t){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.fixedDecimalValue=void 0,r.fixedDecimalValue=function(e,r,t){if(t&&e.length>1){if(e.includes(r)){var a=e.split(r),n=a[0];if((i=a[1]).length>t)return""+n+r+i.slice(0,t)}var i,o=e.length>t?new RegExp("(\\d+)(\\d{"+t+"})"):new RegExp("(\\d)(\\d+)"),u=e.match(o);if(u)return""+(n=u[1])+r+(i=u[2])}return e}},function(e,r,t){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.addSeparators=void 0,r.addSeparators=function(e,r){return void 0===r&&(r=","),e.replace(/\B(?=(\d{3})+(?!\d))/g,r)}},function(e,r,t){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.isNumber=void 0,r.isNumber=function(e){return RegExp(/\d/,"gi").test(e)}},function(e,r,t){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.padTrimValue=void 0,r.padTrimValue=function(e,r,t){if(void 0===r&&(r="."),!t||""===e||void 0===e)return e;if(!e.match(/\d/g))return"";var a=e.split(r),n=a[0],i=a[1]||"";if(i.length<t)for(;i.length<t;)i+="0";else i=i.slice(0,t);return""+n+r+i}}]);
//# sourceMappingURL=index.js.map
{
"name": "react-currency-input-field",
"version": "2.6.0",
"version": "2.7.0",
"description": "React <input /> component for formatting currency and numbers.",

@@ -5,0 +5,0 @@ "files": [

@@ -92,23 +92,24 @@ # React Currency Input Field Component

| Name | Type | Default | Description |
| ------------------ | ---------- | ------- | ------------------------------------------------------------------------ |
| allowDecimals | `boolean` | `true` | Allow decimals |
| allowNegativeValue | `boolean` | `true` | Allow user to enter negative value |
| className | `string` | | Class names |
| decimalsLimit | `number` | `2` | Limit length of decimals allowed |
| defaultValue | `number` | | Default value |
| value | `number` | | Programmatically set the value |
| disabled | `boolean` | `false` | Disabled |
| fixedDecimalLength | `number` | | Value will always have the specified length of decimals |
| id | `string` | | Component id |
| maxLength | `number` | | Maximum characters the user can enter |
| onChange | `function` | | Handle change in value |
| onBlurValue | `function` | | Handle value onBlur |
| placeholder | `string` | | Placeholder if no value |
| precision | `number` | | Specify decimal precision for padding/trimming |
| prefix | `string` | | Include a prefix eg. £ or \$ |
| step | `number` | | Incremental value change on arrow down and arrow up key press |
| decimalSeparator | `string` | `.` | Separator between integer part and fractional part of value |
| groupSeparator | `string` | `,` | Separator between thousand, million and billion |
| turnOffSeparators | `boolean` | `false` | Disable auto adding the group separator between values, eg. 1000 > 1,000 |
| Name | Type | Default | Description |
| -------------------- | ---------- | ------- | ------------------------------------------------------------------------ |
| allowDecimals | `boolean` | `true` | Allow decimals |
| allowNegativeValue | `boolean` | `true` | Allow user to enter negative value |
| className | `string` | | Class names |
| decimalsLimit | `number` | `2` | Limit length of decimals allowed |
| defaultValue | `number` | | Default value |
| value | `number` | | Programmatically set the value |
| disabled | `boolean` | `false` | Disabled |
| fixedDecimalLength | `number` | | Value will always have the specified length of decimals |
| id | `string` | | Component id |
| maxLength | `number` | | Maximum characters the user can enter |
| onChange | `function` | | Handle change in value |
| onBlurValue | `function` | | Handle value onBlur |
| placeholder | `string` | | Placeholder if no value |
| precision | `number` | | Specify decimal precision for padding/trimming |
| prefix | `string` | | Include a prefix eg. £ or \$ |
| step | `number` | | Incremental value change on arrow down and arrow up key press |
| decimalSeparator | `string` | `.` | Separator between integer part and fractional part of value |
| groupSeparator | `string` | `,` | Separator between thousand, million and billion |
| turnOffAbbreviations | `boolean` | `false` | Disable abbreviations eg. 1k > 1,000, 2m > 2,000,000 |
| turnOffSeparators | `boolean` | `false` | Disable auto adding the group separator between values, eg. 1000 > 1,000 |

@@ -115,0 +116,0 @@ ## Format values for display

Sorry, the diff of this file is not supported yet

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