react-currency-input-field
Advanced tools
Comparing version 2.8.0-beta.1 to 3.0.0-beta.1
@@ -1,2 +0,2 @@ | ||
# [2.8.0-beta.1](https://github.com/cchanxzy/react-currency-input-field/compare/v2.7.0...v2.8.0-beta.1) (2020-11-19) | ||
# [3.0.0-beta.1](https://github.com/cchanxzy/react-currency-input-field/compare/v2.7.0...v3.0.0-beta.1) (2020-11-19) | ||
@@ -6,7 +6,9 @@ | ||
* add props decimalSeparator and groupSeparator ([344e3b0](https://github.com/cchanxzy/react-currency-input-field/commit/344e3b03e0f3386fc0b9d713f174dcb16dea05ae)) | ||
* can use any string as a separator ([ae5755a](https://github.com/cchanxzy/react-currency-input-field/commit/ae5755a639909fe297e6da47f13568748f705a1e)) | ||
* fixed decimal length prop ([7089248](https://github.com/cchanxzy/react-currency-input-field/commit/70892489f5f62a914e5b26e2cb461e25076a1441)) | ||
* handle negative values ([b581e17](https://github.com/cchanxzy/react-currency-input-field/commit/b581e177510e2016051a4b611f86cea9ad7e34c9)) | ||
* wrap component in forwardRef ([3a1f5bc](https://github.com/cchanxzy/react-currency-input-field/commit/3a1f5bcd6422c49ea85ad9980109cd183ceec2f1)) | ||
### BREAKING CHANGES | ||
* can pass in component ref | ||
# [2.7.0](https://github.com/cchanxzy/react-currency-input-field/compare/v2.6.0...v2.7.0) (2020-11-18) | ||
@@ -13,0 +15,0 @@ |
@@ -1,2 +0,2 @@ | ||
/// <reference types="react" /> | ||
import { Ref } from 'react'; | ||
declare type Overwrite<T, U> = Pick<T, Exclude<keyof T, keyof U>> & U; | ||
@@ -98,3 +98,7 @@ export declare type Separator = ',' | '.'; | ||
turnOffAbbreviations?: boolean; | ||
/** | ||
* Ref property | ||
*/ | ||
ref?: Ref<HTMLInputElement>; | ||
}>; | ||
export {}; |
@@ -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 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}}]); | ||
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),p=d?f.replace("-",""):f,v=s?p.split(o):[p],m=v[0],b=v[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=l.forwardRef((function(e,r){var t=e.allowDecimals,n=void 0===t||t,i=e.allowNegativeValue,o=void 0===i||i,f=e.id,d=e.name,s=e.className,p=e.decimalsLimit,v=e.defaultValue,m=e.disabled,b=void 0!==m&&m,g=e.maxLength,h=e.value,y=e.onChange,_=e.onBlurValue,O=e.fixedDecimalLength,S=e.placeholder,x=e.precision,j=e.prefix,w=e.step,V=e.decimalSeparator,P=void 0===V?".":V,M=e.groupSeparator,E=void 0===M?",":M,R=e.turnOffSeparators,N=void 0!==R&&R,C=e.turnOffAbbreviations,D=void 0!==C&&C,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(P===E)throw new Error("decimalSeparator cannot be the same as groupSeparator");if(c.isNumber(P))throw new Error("decimalSeparator cannot be a number");if(c.isNumber(E))throw new Error("groupSeparator cannot be a number");var L={decimalSeparator:P,groupSeparator:E,turnOffSeparators:N,prefix:j},I={decimalSeparator:P,groupSeparator:E,allowDecimals:n,decimalsLimit:p||O||2,allowNegativeValue:o,turnOffAbbreviations:D,prefix:j},B=void 0!==v?c.formatValue(a({value:String(v)},L)):"",T=l.useState(B),k=T[0],$=T[1],U=l.useState(0),q=U[0],F=U[1],G=r||l.useRef(null),K=function(e,r){var t=c.cleanValue(a({value:e},I));if(!t)return y&&y(void 0,d),void $("");if(!(g&&t.replace(/-/g,"").length>g)){if("-"===t)return y&&y(void 0,d),void $(e);var n=c.formatValue(a({value:t},L));if(null!=r){var i=r+(n.length-e.length)||1;F(i)}$(n),y&&y(t,d)}};l.useEffect((function(){G&&"object"==typeof G&&G.current&&G.current.setSelectionRange(q,q)}),[q,G]);var z=void 0!==h?c.formatValue(a({value:String(h)},L)):void 0;return l.default.createElement("input",a({type:"text",inputMode:"decimal",id:f,name:d,className:s,onChange:function(e){var r=e.target,t=r.value,a=r.selectionStart;K(t,a)},onBlur:function(e){var r=e.target.value,t=c.cleanValue(a({value:r},I));if("-"===t||!t)return _&&_(void 0,d),void $("");var n=c.fixedDecimalValue(t,P,O),i=c.padTrimValue(n,P,x||O);y&&y(i,d),_&&_(i,d);var o=c.formatValue(a({value:i},L));$(o)},onFocus:function(){return k?k.length:0},onKeyDown:function(e){var r=e.key;if(w&&("ArrowUp"===r||"ArrowDown"===r)){var t=Number(void 0!==h?h:c.cleanValue(a({value:k},I)))||0,n=String("ArrowUp"===r?t+Number(w):t-Number(w));K(n)}},placeholder:S,disabled:b,value:void 0!==z&&"-"!==k?z:k,ref:G},A))})),r.CurrencyInput.displayName="CurrencyInput",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,p=e.decimalsLimit,v=void 0===p?2:p,m=e.allowNegativeValue,b=void 0===m||m,g=e.turnOffAbbreviations,h=void 0!==g&&g,y=e.prefix,_=void 0===y?"":y,O=h?[]:["k","m","b"],S=r.includes("-"),x=RegExp("(\\d+)-?"+u.escapeRegExp(_)).exec(r)||[],j=x[0],w=x[1],V=_?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 C=M.split(f),D=C[0],A=C[1],L=v?A.slice(0,v):A;return""+N+D+(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.8.0-beta.1", | ||
"version": "3.0.0-beta.1", | ||
"description": "React <input /> component for formatting currency and numbers.", | ||
@@ -5,0 +5,0 @@ "files": [ |
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
66168
232