New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

react-number-format

Package Overview
Dependencies
Maintainers
1
Versions
121
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-number-format - npm Package Compare versions

Comparing version 3.5.2 to 3.6.0

dist/react-number-format.es.js

11

dist/react-number-format.min.js

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

/*!
* react-number-format - 3.5.2
/**
* react-number-format - 3.6.0
* Author : Sudhanshu Yadav
* Copyright (c) 2016,2018 to Sudhanshu Yadav - ignitersworld.com , released under the MIT license.
* Copyright (c) 2016, 2018 to Sudhanshu Yadav, released under the MIT license.
* https://github.com/s-yadav/react-number-format
*/
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("react")):"function"==typeof define&&define.amd?define(["react"],e):"object"==typeof exports?exports.NumberFormat=e(require("react")):t.NumberFormat=e(t.React)}(this,function(t){return function(t){function e(r){if(n[r])return n[r].exports;var o=n[r]={exports:{},id:r,loaded:!1};return t[r].call(o.exports,o,o.exports,e),o.loaded=!0,o.exports}var n={};return e.m=t,e.c=n,e.p="",e(0)}([function(t,e,n){t.exports=n(1)},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(e,"__esModule",{value:!0});var o=n(2),i=r(o),u=n(40),a=r(u),f=n(45),s=r(f),c=n(46),l=r(c),p=n(50),d=r(p),h=n(84),v=r(h),g=n(92),m=r(g),y=n(97),b=r(y),x=n(98),S={thousandSeparator:m.default.oneOfType([m.default.string,m.default.oneOf([!0])]),decimalSeparator:m.default.string,decimalScale:m.default.number,fixedDecimalScale:m.default.bool,displayType:m.default.oneOf(["input","text"]),prefix:m.default.string,suffix:m.default.string,format:m.default.oneOfType([m.default.string,m.default.func]),removeFormatting:m.default.func,mask:m.default.oneOfType([m.default.string,m.default.arrayOf(m.default.string)]),value:m.default.oneOfType([m.default.number,m.default.string]),isNumericString:m.default.bool,customInput:m.default.func,allowNegative:m.default.bool,allowEmptyFormatting:m.default.bool,onValueChange:m.default.func,onKeyDown:m.default.func,onMouseUp:m.default.func,onChange:m.default.func,onFocus:m.default.func,onBlur:m.default.func,type:m.default.oneOf(["text","tel"]),isAllowed:m.default.func,renderText:m.default.func,getInputRef:m.default.func},O={displayType:"input",decimalSeparator:".",fixedDecimalScale:!1,prefix:"",suffix:"",allowNegative:!0,allowEmptyFormatting:!1,isNumericString:!1,type:"text",onValueChange:x.noop,onChange:x.noop,onKeyDown:x.noop,onMouseUp:x.noop,onFocus:x.noop,onBlur:x.noop,isAllowed:x.returnTrue,getInputRef:x.noop},_=function(t){function e(t){(0,s.default)(this,e);var n=(0,d.default)(this,(e.__proto__||(0,a.default)(e)).call(this,t));n.validateProps();var r=n.formatValueProp();return n.state={value:r,numAsString:n.removeFormatting(r)},n.selectionBeforeInput={selectionStart:0,selectionEnd:0},n.onChange=n.onChange.bind(n),n.onKeyDown=n.onKeyDown.bind(n),n.onMouseUp=n.onMouseUp.bind(n),n.onFocus=n.onFocus.bind(n),n.onBlur=n.onBlur.bind(n),n}return(0,v.default)(e,t),(0,l.default)(e,[{key:"componentDidUpdate",value:function(t){this.updateValueIfRequired(t)}},{key:"updateValueIfRequired",value:function(t){var e=this.props,n=this.state;if(t!==e){this.validateProps();var r=n.value,o=n.numAsString||"",i=this.formatNumString(o),u=void 0===e.value?i:this.formatValueProp(),a=this.removeFormatting(u),f=parseFloat(a),s=parseFloat(o);(isNaN(f)&&isNaN(s)||f===s)&&i===r||this.setState({value:u,numAsString:a})}}},{key:"getFloatString",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",e=this.props.decimalScale,n=this.getSeparators(),r=n.decimalSeparator,o=this.getNumberRegex(!0),i="-"===t[0];i&&(t=t.replace("-","")),r&&0===e&&(t=t.split(r)[0]),t=(t.match(o)||[]).join("").replace(r,".");var u=t.indexOf(".");return u!==-1&&(t=t.substring(0,u)+"."+t.substring(u+1,t.length).replace(new RegExp((0,x.escapeRegExp)(r),"g"),"")),i&&(t="-"+t),t}},{key:"getNumberRegex",value:function(t,e){var n=this.props,r=n.format,o=n.decimalScale,i=this.getSeparators(),u=i.decimalSeparator;return new RegExp("\\d"+(!u||0===o||e||r?"":"|"+(0,x.escapeRegExp)(u)),t?"g":void 0)}},{key:"getSeparators",value:function(){var t=this.props.decimalSeparator,e=this.props.thousandSeparator;return e===!0&&(e=","),{decimalSeparator:t,thousandSeparator:e}}},{key:"getMaskAtIndex",value:function(t){var e=this.props.mask,n=void 0===e?" ":e;return"string"==typeof n?n:n[t]||" "}},{key:"getValueObject",value:function(t,e){var n=parseFloat(e);return{formattedValue:t,value:e,floatValue:isNaN(n)?void 0:n}}},{key:"validateProps",value:function(){var t=this.props.mask,e=this.getSeparators(),n=e.decimalSeparator,r=e.thousandSeparator;if(n===r)throw new Error("\n Decimal separator can't be same as thousand separator.\n\n thousandSeparator: "+r+' (thousandSeparator = {true} is same as thousandSeparator = ",")\n decimalSeparator: '+n+" (default value for decimalSeparator is .)\n ");if(t){var o="string"===t?t:t.toString();if(o.match(/\d/g))throw new Error("\n Mask "+t+" should not contain numeric character;\n ")}}},{key:"setPatchedCaretPosition",value:function(t,e,n){(0,x.setCaretPosition)(t,e),setTimeout(function(){t.value===n&&(0,x.setCaretPosition)(t,e)},0)}},{key:"correctCaretPosition",value:function(t,e,n){var r=this.props,o=r.prefix,i=r.suffix,u=r.format;if(""===t)return 0;if(e=(0,x.clamp)(e,0,t.length),!u){var a="-"===t[0];return(0,x.clamp)(e,o.length+(a?1:0),t.length-i.length)}if("function"==typeof u)return e;if("#"===u[e]&&(0,x.charIsNumber)(t[e]))return e;if("#"===u[e-1]&&(0,x.charIsNumber)(t[e-1]))return e;var f=u.indexOf("#"),s=u.lastIndexOf("#");e=(0,x.clamp)(e,f,s+1);for(var c=u.substring(e,u.length).indexOf("#"),l=e,p=e+(c===-1?0:c);l>f&&("#"!==u[l]||!(0,x.charIsNumber)(t[l]));)l-=1;var d=!(0,x.charIsNumber)(t[p])||"left"===n&&e!==f||e-l<p-e;return d?(0,x.charIsNumber)(t[l])?l+1:l:p}},{key:"getCaretPosition",value:function(t,e,n){var r=this.props.format,o=this.state.value,i=this.getNumberRegex(!0),u=(t.match(i)||[]).join(""),a=(e.match(i)||[]).join(""),f=void 0,s=void 0;for(f=0,s=0;s<n;s++){var c=t[s]||"",l=e[f]||"";if((c.match(i)||c===l)&&("0"!==c||!l.match(i)||"0"===l||u.length===a.length)){for(;c!==e[f]&&f<e.length;)f++;f++}}return"string"!=typeof r||o||(f=e.length),f=this.correctCaretPosition(e,f)}},{key:"removePrefixAndSuffix",value:function(t){var e=this.props,n=e.format,r=e.prefix,o=e.suffix;if(!n&&t){var i="-"===t[0];i&&(t=t.substring(1,t.length)),t=r&&0===t.indexOf(r)?t.substring(r.length,t.length):t;var u=t.lastIndexOf(o);t=o&&u!==-1&&u===t.length-o.length?t.substring(0,u):t,i&&(t="-"+t)}return t}},{key:"removePatternFormatting",value:function(t){for(var e=this.props.format,n=e.split("#").filter(function(t){return""!==t}),r=0,o="",i=0,u=n.length;i<=u;i++){var a=n[i]||"",f=i===u?t.length:t.indexOf(a,r);if(f===-1){o=t;break}o+=t.substring(r,f),r=f+a.length}return(o.match(/\d/g)||[]).join("")}},{key:"removeFormatting",value:function t(e){var n=this.props,r=n.format,t=n.removeFormatting;return e?(r?e="string"==typeof r?this.removePatternFormatting(e):"function"==typeof t?t(e):(e.match(/\d/g)||[]).join(""):(e=this.removePrefixAndSuffix(e),e=this.getFloatString(e)),e):e}},{key:"formatWithPattern",value:function(t){for(var e=this.props.format,n=0,r=e.split(""),o=0,i=e.length;o<i;o++)"#"===e[o]&&(r[o]=t[n]||this.getMaskAtIndex(n),n+=1);return r.join("")}},{key:"formatAsNumber",value:function(t){var e=this.props,n=e.decimalScale,r=e.fixedDecimalScale,o=e.prefix,i=e.suffix,u=e.allowNegative,a=this.getSeparators(),f=a.thousandSeparator,s=a.decimalSeparator,c=t.indexOf(".")!==-1||n&&r,l=(0,x.splitDecimal)(t,u),p=l.beforeDecimal,d=l.afterDecimal,h=l.addNegation;return void 0!==n&&(d=(0,x.limitToScale)(d,n,r)),f&&(p=p.replace(/(\d)(?=(\d{3})+(?!\d))/g,"$1"+f)),o&&(p=o+p),i&&(d+=i),h&&(p="-"+p),t=p+(c&&s||"")+d}},{key:"formatNumString",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",e=this.props,n=e.format,r=e.allowEmptyFormatting,o=t;return""!==t||r?"-"!==t||n?o="string"==typeof n?this.formatWithPattern(o):"function"==typeof n?n(o):this.formatAsNumber(o):(o="-",t=""):o="",o}},{key:"formatValueProp",value:function(){var t=this.props,e=t.format,n=t.decimalScale,r=t.fixedDecimalScale,o=t.allowEmptyFormatting,i=this.props,u=i.value,a=i.isNumericString,f=!u&&0!==u;if(f&&o&&(u=""),f&&!o)return"";"number"==typeof u&&(u=u.toString(),a=!0),a&&!e&&"number"==typeof n&&(u=(0,x.roundToPrecision)(u,n,r));var s=a?this.formatNumString(u):this.formatInput(u);return s}},{key:"formatNegation",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",e=this.props.allowNegative,n=new RegExp("(-)"),r=new RegExp("(-)(.)*(-)"),o=n.test(t),i=r.test(t);return t=t.replace(/-/g,""),o&&!i&&e&&(t="-"+t),t}},{key:"formatInput",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",e=this.props.format;return e||(t=this.formatNegation(t)),t=this.removeFormatting(t),this.formatNumString(t)}},{key:"isCharacterAFormat",value:function(t,e){var n=this.props,r=n.format,o=n.prefix,i=n.suffix,u=n.decimalScale,a=n.fixedDecimalScale,f=this.getSeparators(),s=f.decimalSeparator;return"string"==typeof r&&"#"!==r[t]||!(r||!(t<o.length||t>=e.length-i.length||u&&a&&e[t]===s))}},{key:"checkIfFormatGotDeleted",value:function(t,e,n){for(var r=t;r<e;r++)if(this.isCharacterAFormat(r,n))return!0;return!1}},{key:"correctInputValue",value:function(t,e,n){var r=this.props,o=r.format,i=r.decimalSeparator,u=r.allowNegative,a=this.state.numAsString||"",f=this.selectionBeforeInput,s=f.selectionStart,c=f.selectionEnd,l=(0,x.findChangedIndex)(e,n),p=l.start,d=l.end;if(n.length>e.length||!n.length||p===d||0===p&&d===e.length||0===s&&c===e.length)return n;if(this.checkIfFormatGotDeleted(p,d,e)&&(n=e),!o){var h=this.removeFormatting(n),v=(0,x.splitDecimal)(h,u),g=v.beforeDecimal,m=v.afterDecimal,y=v.addNegation,b=t<n.indexOf(i)+1;if(h.length<a.length&&b&&""===g&&!parseFloat(m))return y?"-":""}return n}},{key:"onChange",value:function(t){t.persist();var e=t.target,n=e.value,r=this.state,o=this.props,i=o.isAllowed,u=r.value||"",a=Math.max(e.selectionStart,e.selectionEnd);n=this.correctInputValue(a,u,n);var f=this.formatInput(n)||"",s=this.removeFormatting(f),c=this.getValueObject(f,s);i(c)||(f=u),e.value=f;var l=this.getCaretPosition(n,f,a);this.setPatchedCaretPosition(e,l,f),f!==u?this.setState({value:f,numAsString:s},function(){o.onValueChange(c,t),o.onChange(t)}):o.onChange(t)}},{key:"onBlur",value:function t(e){var n=this,r=this.props,o=this.state,i=r.format,t=r.onBlur,u=o.numAsString,a=o.value;if(!i){u=(0,x.fixLeadingZero)(u);var f=this.formatNumString(u);if(f!==a)return e.persist(),void this.setState({value:f,numAsString:u},function(){var o=n.getValueObject(f,u);r.onValueChange(o,e),t(e)})}t(e)}},{key:"onKeyDown",value:function t(e){var n=this,r=e.target,o=e.key,i=r.selectionStart,u=r.selectionEnd,a=r.value,f=void 0===a?"":a,s=void 0,c=this.props,l=c.decimalScale,p=c.fixedDecimalScale,d=c.prefix,h=c.suffix,v=c.format,t=c.onKeyDown,g=c.onValueChange,m=void 0!==l&&p,y=this.getNumberRegex(!1,m),b=new RegExp("-"),x="string"==typeof v;if(this.selectionBeforeInput={selectionStart:i,selectionEnd:u},"ArrowLeft"===o||"Backspace"===o?s=i-1:"ArrowRight"===o?s=i+1:"Delete"===o&&(s=i),void 0===s||i!==u)return void t(e);var S=s,O=x?v.indexOf("#"):d.length,_=x?v.lastIndexOf("#")+1:f.length-h.length;if("ArrowLeft"===o||"ArrowRight"===o){var w="ArrowLeft"===o?"left":"right";S=this.correctCaretPosition(f,s,w)}else if("Delete"!==o||y.test(f[s])||b.test(f[s])){if("Backspace"===o&&!y.test(f[s]))if(i<=O+1&&"-"===f[0]&&"undefined"==typeof v){var P=f.substring(1),j=this.removeFormatting(P),k=this.getValueObject(P,j);e.persist(),this.setState({value:P,numAsString:j},function(){n.setPatchedCaretPosition(r,S,P),g(k,e)})}else if(!b.test(f[s])){for(;!y.test(f[S-1])&&S>O;)S--;S=this.correctCaretPosition(f,S,"left")}}else for(;!y.test(f[S])&&S<_;)S++;(S!==s||s<O||s>_)&&(e.preventDefault(),this.setPatchedCaretPosition(r,S,f)),e.isUnitTestRun&&this.setPatchedCaretPosition(r,S,f),this.props.onKeyDown(e)}},{key:"onMouseUp",value:function(t){var e=t.target,n=e.selectionStart,r=e.selectionEnd,o=e.value,i=void 0===o?"":o;if(n===r){var u=this.correctCaretPosition(i,n);u!==n&&this.setPatchedCaretPosition(e,u,i)}this.props.onMouseUp(t)}},{key:"onFocus",value:function(t){var e=this;t.persist(),setTimeout(function(){var n=t.target,r=n.selectionStart,o=n.value,i=void 0===o?"":o,u=e.correctCaretPosition(i,r);u!==r&&e.setPatchedCaretPosition(n,u,i),e.props.onFocus(t)},0)}},{key:"render",value:function(){var t=this.props,e=t.type,n=t.displayType,r=t.customInput,o=t.renderText,u=t.getInputRef,a=this.state.value,f=(0,x.omit)(this.props,S),s=(0,i.default)({},f,{type:e,value:a,onChange:this.onChange,onKeyDown:this.onKeyDown,onMouseUp:this.onMouseUp,onFocus:this.onFocus,onBlur:this.onBlur});if("text"===n)return o?o(a)||null:b.default.createElement("span",(0,i.default)({},f,{ref:u}),a);if(r){var c=r;return b.default.createElement(c,s)}return b.default.createElement("input",(0,i.default)({},s,{ref:u}))}}]),e}(b.default.Component);_.propTypes=S,_.defaultProps=O,e.default=_,t.exports=e.default},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}e.__esModule=!0;var o=n(3),i=r(o);e.default=i.default||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t}},function(t,e,n){t.exports={default:n(4),__esModule:!0}},function(t,e,n){n(5),t.exports=n(8).Object.assign},function(t,e,n){var r=n(6);r(r.S+r.F,"Object",{assign:n(21)})},function(t,e,n){var r=n(7),o=n(8),i=n(9),u=n(11),a="prototype",f=function(t,e,n){var s,c,l,p=t&f.F,d=t&f.G,h=t&f.S,v=t&f.P,g=t&f.B,m=t&f.W,y=d?o:o[e]||(o[e]={}),b=y[a],x=d?r:h?r[e]:(r[e]||{})[a];d&&(n=e);for(s in n)c=!p&&x&&void 0!==x[s],c&&s in y||(l=c?x[s]:n[s],y[s]=d&&"function"!=typeof x[s]?n[s]:g&&c?i(l,r):m&&x[s]==l?function(t){var e=function(e,n,r){if(this instanceof t){switch(arguments.length){case 0:return new t;case 1:return new t(e);case 2:return new t(e,n)}return new t(e,n,r)}return t.apply(this,arguments)};return e[a]=t[a],e}(l):v&&"function"==typeof l?i(Function.call,l):l,v&&((y.virtual||(y.virtual={}))[s]=l,t&f.R&&b&&!b[s]&&u(b,s,l)))};f.F=1,f.G=2,f.S=4,f.P=8,f.B=16,f.W=32,f.U=64,f.R=128,t.exports=f},function(t,e){var n=t.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=n)},function(t,e){var n=t.exports={version:"2.5.1"};"number"==typeof __e&&(__e=n)},function(t,e,n){var r=n(10);t.exports=function(t,e,n){if(r(t),void 0===e)return t;switch(n){case 1:return function(n){return t.call(e,n)};case 2:return function(n,r){return t.call(e,n,r)};case 3:return function(n,r,o){return t.call(e,n,r,o)}}return function(){return t.apply(e,arguments)}}},function(t,e){t.exports=function(t){if("function"!=typeof t)throw TypeError(t+" is not a function!");return t}},function(t,e,n){var r=n(12),o=n(20);t.exports=n(16)?function(t,e,n){return r.f(t,e,o(1,n))}:function(t,e,n){return t[e]=n,t}},function(t,e,n){var r=n(13),o=n(15),i=n(19),u=Object.defineProperty;e.f=n(16)?Object.defineProperty:function(t,e,n){if(r(t),e=i(e,!0),r(n),o)try{return u(t,e,n)}catch(t){}if("get"in n||"set"in n)throw TypeError("Accessors not supported!");return"value"in n&&(t[e]=n.value),t}},function(t,e,n){var r=n(14);t.exports=function(t){if(!r(t))throw TypeError(t+" is not an object!");return t}},function(t,e){t.exports=function(t){return"object"==typeof t?null!==t:"function"==typeof t}},function(t,e,n){t.exports=!n(16)&&!n(17)(function(){return 7!=Object.defineProperty(n(18)("div"),"a",{get:function(){return 7}}).a})},function(t,e,n){t.exports=!n(17)(function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a})},function(t,e){t.exports=function(t){try{return!!t()}catch(t){return!0}}},function(t,e,n){var r=n(14),o=n(7).document,i=r(o)&&r(o.createElement);t.exports=function(t){return i?o.createElement(t):{}}},function(t,e,n){var r=n(14);t.exports=function(t,e){if(!r(t))return t;var n,o;if(e&&"function"==typeof(n=t.toString)&&!r(o=n.call(t)))return o;if("function"==typeof(n=t.valueOf)&&!r(o=n.call(t)))return o;if(!e&&"function"==typeof(n=t.toString)&&!r(o=n.call(t)))return o;throw TypeError("Can't convert object to primitive value")}},function(t,e){t.exports=function(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}}},function(t,e,n){"use strict";var r=n(22),o=n(37),i=n(38),u=n(39),a=n(26),f=Object.assign;t.exports=!f||n(17)(function(){var t={},e={},n=Symbol(),r="abcdefghijklmnopqrst";return t[n]=7,r.split("").forEach(function(t){e[t]=t}),7!=f({},t)[n]||Object.keys(f({},e)).join("")!=r})?function(t,e){for(var n=u(t),f=arguments.length,s=1,c=o.f,l=i.f;f>s;)for(var p,d=a(arguments[s++]),h=c?r(d).concat(c(d)):r(d),v=h.length,g=0;v>g;)l.call(d,p=h[g++])&&(n[p]=d[p]);return n}:f},function(t,e,n){var r=n(23),o=n(36);t.exports=Object.keys||function(t){return r(t,o)}},function(t,e,n){var r=n(24),o=n(25),i=n(29)(!1),u=n(33)("IE_PROTO");t.exports=function(t,e){var n,a=o(t),f=0,s=[];for(n in a)n!=u&&r(a,n)&&s.push(n);for(;e.length>f;)r(a,n=e[f++])&&(~i(s,n)||s.push(n));return s}},function(t,e){var n={}.hasOwnProperty;t.exports=function(t,e){return n.call(t,e)}},function(t,e,n){var r=n(26),o=n(28);t.exports=function(t){return r(o(t))}},function(t,e,n){var r=n(27);t.exports=Object("z").propertyIsEnumerable(0)?Object:function(t){return"String"==r(t)?t.split(""):Object(t)}},function(t,e){var n={}.toString;t.exports=function(t){return n.call(t).slice(8,-1)}},function(t,e){t.exports=function(t){if(void 0==t)throw TypeError("Can't call method on "+t);return t}},function(t,e,n){var r=n(25),o=n(30),i=n(32);t.exports=function(t){return function(e,n,u){var a,f=r(e),s=o(f.length),c=i(u,s);if(t&&n!=n){for(;s>c;)if(a=f[c++],a!=a)return!0}else for(;s>c;c++)if((t||c in f)&&f[c]===n)return t||c||0;return!t&&-1}}},function(t,e,n){var r=n(31),o=Math.min;t.exports=function(t){return t>0?o(r(t),9007199254740991):0}},function(t,e){var n=Math.ceil,r=Math.floor;t.exports=function(t){return isNaN(t=+t)?0:(t>0?r:n)(t)}},function(t,e,n){var r=n(31),o=Math.max,i=Math.min;t.exports=function(t,e){return t=r(t),t<0?o(t+e,0):i(t,e)}},function(t,e,n){var r=n(34)("keys"),o=n(35);t.exports=function(t){return r[t]||(r[t]=o(t))}},function(t,e,n){var r=n(7),o="__core-js_shared__",i=r[o]||(r[o]={});t.exports=function(t){return i[t]||(i[t]={})}},function(t,e){var n=0,r=Math.random();t.exports=function(t){return"Symbol(".concat(void 0===t?"":t,")_",(++n+r).toString(36))}},function(t,e){t.exports="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(",")},function(t,e){e.f=Object.getOwnPropertySymbols},function(t,e){e.f={}.propertyIsEnumerable},function(t,e,n){var r=n(28);t.exports=function(t){return Object(r(t))}},function(t,e,n){t.exports={default:n(41),__esModule:!0}},function(t,e,n){n(42),t.exports=n(8).Object.getPrototypeOf},function(t,e,n){var r=n(39),o=n(43);n(44)("getPrototypeOf",function(){return function(t){return o(r(t))}})},function(t,e,n){var r=n(24),o=n(39),i=n(33)("IE_PROTO"),u=Object.prototype;t.exports=Object.getPrototypeOf||function(t){return t=o(t),r(t,i)?t[i]:"function"==typeof t.constructor&&t instanceof t.constructor?t.constructor.prototype:t instanceof Object?u:null}},function(t,e,n){var r=n(6),o=n(8),i=n(17);t.exports=function(t,e){var n=(o.Object||{})[t]||Object[t],u={};u[t]=e(n),r(r.S+r.F*i(function(){n(1)}),"Object",u)}},function(t,e){"use strict";e.__esModule=!0,e.default=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}e.__esModule=!0;var o=n(47),i=r(o);e.default=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),(0,i.default)(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}()},function(t,e,n){t.exports={default:n(48),__esModule:!0}},function(t,e,n){n(49);var r=n(8).Object;t.exports=function(t,e,n){return r.defineProperty(t,e,n)}},function(t,e,n){var r=n(6);r(r.S+r.F*!n(16),"Object",{defineProperty:n(12).f})},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}e.__esModule=!0;var o=n(51),i=r(o);e.default=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!==("undefined"==typeof e?"undefined":(0,i.default)(e))&&"function"!=typeof e?t:e}},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}e.__esModule=!0;var o=n(52),i=r(o),u=n(71),a=r(u),f="function"==typeof a.default&&"symbol"==typeof i.default?function(t){return typeof t}:function(t){return t&&"function"==typeof a.default&&t.constructor===a.default&&t!==a.default.prototype?"symbol":typeof t};e.default="function"==typeof a.default&&"symbol"===f(i.default)?function(t){return"undefined"==typeof t?"undefined":f(t)}:function(t){return t&&"function"==typeof a.default&&t.constructor===a.default&&t!==a.default.prototype?"symbol":"undefined"==typeof t?"undefined":f(t)}},function(t,e,n){t.exports={default:n(53),__esModule:!0}},function(t,e,n){n(54),n(66),t.exports=n(70).f("iterator")},function(t,e,n){"use strict";var r=n(55)(!0);n(56)(String,"String",function(t){this._t=String(t),this._i=0},function(){var t,e=this._t,n=this._i;return n>=e.length?{value:void 0,done:!0}:(t=r(e,n),this._i+=t.length,{value:t,done:!1})})},function(t,e,n){var r=n(31),o=n(28);t.exports=function(t){return function(e,n){var i,u,a=String(o(e)),f=r(n),s=a.length;return f<0||f>=s?t?"":void 0:(i=a.charCodeAt(f),i<55296||i>56319||f+1===s||(u=a.charCodeAt(f+1))<56320||u>57343?t?a.charAt(f):i:t?a.slice(f,f+2):(i-55296<<10)+(u-56320)+65536)}}},function(t,e,n){"use strict";var r=n(57),o=n(6),i=n(58),u=n(11),a=n(24),f=n(59),s=n(60),c=n(64),l=n(43),p=n(65)("iterator"),d=!([].keys&&"next"in[].keys()),h="@@iterator",v="keys",g="values",m=function(){return this};t.exports=function(t,e,n,y,b,x,S){s(n,e,y);var O,_,w,P=function(t){if(!d&&t in T)return T[t];switch(t){case v:return function(){return new n(this,t)};case g:return function(){return new n(this,t)}}return function(){return new n(this,t)}},j=e+" Iterator",k=b==g,E=!1,T=t.prototype,M=T[p]||T[h]||b&&T[b],N=M||P(b),F=b?k?P("entries"):N:void 0,C="Array"==e?T.entries||M:M;if(C&&(w=l(C.call(new t)),w!==Object.prototype&&w.next&&(c(w,j,!0),r||a(w,p)||u(w,p,m))),k&&M&&M.name!==g&&(E=!0,N=function(){return M.call(this)}),r&&!S||!d&&!E&&T[p]||u(T,p,N),f[e]=N,f[j]=m,b)if(O={values:k?N:P(g),keys:x?N:P(v),entries:F},S)for(_ in O)_ in T||i(T,_,O[_]);else o(o.P+o.F*(d||E),e,O);return O}},function(t,e){t.exports=!0},function(t,e,n){t.exports=n(11)},function(t,e){t.exports={}},function(t,e,n){"use strict";var r=n(61),o=n(20),i=n(64),u={};n(11)(u,n(65)("iterator"),function(){return this}),t.exports=function(t,e,n){t.prototype=r(u,{next:o(1,n)}),i(t,e+" Iterator")}},function(t,e,n){var r=n(13),o=n(62),i=n(36),u=n(33)("IE_PROTO"),a=function(){},f="prototype",s=function(){var t,e=n(18)("iframe"),r=i.length,o="<",u=">";for(e.style.display="none",n(63).appendChild(e),e.src="javascript:",t=e.contentWindow.document,t.open(),t.write(o+"script"+u+"document.F=Object"+o+"/script"+u),t.close(),s=t.F;r--;)delete s[f][i[r]];return s()};t.exports=Object.create||function(t,e){var n;return null!==t?(a[f]=r(t),n=new a,a[f]=null,n[u]=t):n=s(),void 0===e?n:o(n,e)}},function(t,e,n){var r=n(12),o=n(13),i=n(22);t.exports=n(16)?Object.defineProperties:function(t,e){o(t);for(var n,u=i(e),a=u.length,f=0;a>f;)r.f(t,n=u[f++],e[n]);return t}},function(t,e,n){var r=n(7).document;t.exports=r&&r.documentElement},function(t,e,n){var r=n(12).f,o=n(24),i=n(65)("toStringTag");t.exports=function(t,e,n){t&&!o(t=n?t:t.prototype,i)&&r(t,i,{configurable:!0,value:e})}},function(t,e,n){var r=n(34)("wks"),o=n(35),i=n(7).Symbol,u="function"==typeof i,a=t.exports=function(t){return r[t]||(r[t]=u&&i[t]||(u?i:o)("Symbol."+t))};a.store=r},function(t,e,n){n(67);for(var r=n(7),o=n(11),i=n(59),u=n(65)("toStringTag"),a="CSSRuleList,CSSStyleDeclaration,CSSValueList,ClientRectList,DOMRectList,DOMStringList,DOMTokenList,DataTransferItemList,FileList,HTMLAllCollection,HTMLCollection,HTMLFormElement,HTMLSelectElement,MediaList,MimeTypeArray,NamedNodeMap,NodeList,PaintRequestList,Plugin,PluginArray,SVGLengthList,SVGNumberList,SVGPathSegList,SVGPointList,SVGStringList,SVGTransformList,SourceBufferList,StyleSheetList,TextTrackCueList,TextTrackList,TouchList".split(","),f=0;f<a.length;f++){var s=a[f],c=r[s],l=c&&c.prototype;l&&!l[u]&&o(l,u,s),i[s]=i.Array}},function(t,e,n){"use strict";var r=n(68),o=n(69),i=n(59),u=n(25);t.exports=n(56)(Array,"Array",function(t,e){this._t=u(t),this._i=0,this._k=e},function(){var t=this._t,e=this._k,n=this._i++;return!t||n>=t.length?(this._t=void 0,o(1)):"keys"==e?o(0,n):"values"==e?o(0,t[n]):o(0,[n,t[n]])},"values"),i.Arguments=i.Array,r("keys"),r("values"),r("entries")},function(t,e){t.exports=function(){}},function(t,e){t.exports=function(t,e){return{value:e,done:!!t}}},function(t,e,n){e.f=n(65)},function(t,e,n){t.exports={default:n(72),__esModule:!0}},function(t,e,n){n(73),n(81),n(82),n(83),t.exports=n(8).Symbol},function(t,e,n){"use strict";var r=n(7),o=n(24),i=n(16),u=n(6),a=n(58),f=n(74).KEY,s=n(17),c=n(34),l=n(64),p=n(35),d=n(65),h=n(70),v=n(75),g=n(76),m=n(77),y=n(13),b=n(25),x=n(19),S=n(20),O=n(61),_=n(78),w=n(80),P=n(12),j=n(22),k=w.f,E=P.f,T=_.f,M=r.Symbol,N=r.JSON,F=N&&N.stringify,C="prototype",I=d("_hidden"),R=d("toPrimitive"),A={}.propertyIsEnumerable,D=c("symbol-registry"),L=c("symbols"),V=c("op-symbols"),B=Object[C],U="function"==typeof M,K=r.QObject,G=!K||!K[C]||!K[C].findChild,W=i&&s(function(){return 7!=O(E({},"a",{get:function(){return E(this,"a",{value:7}).a}})).a})?function(t,e,n){var r=k(B,e);r&&delete B[e],E(t,e,n),r&&t!==B&&E(B,e,r)}:E,q=function(t){var e=L[t]=O(M[C]);return e._k=t,e},H=U&&"symbol"==typeof M.iterator?function(t){return"symbol"==typeof t}:function(t){return t instanceof M},J=function(t,e,n){return t===B&&J(V,e,n),y(t),e=x(e,!0),y(n),o(L,e)?(n.enumerable?(o(t,I)&&t[I][e]&&(t[I][e]=!1),n=O(n,{enumerable:S(0,!1)})):(o(t,I)||E(t,I,S(1,{})),t[I][e]=!0),W(t,e,n)):E(t,e,n)},Y=function(t,e){y(t);for(var n,r=g(e=b(e)),o=0,i=r.length;i>o;)J(t,n=r[o++],e[n]);return t},$=function(t,e){return void 0===e?O(t):Y(O(t),e)},z=function(t){var e=A.call(this,t=x(t,!0));return!(this===B&&o(L,t)&&!o(V,t))&&(!(e||!o(this,t)||!o(L,t)||o(this,I)&&this[I][t])||e)},Z=function(t,e){if(t=b(t),e=x(e,!0),t!==B||!o(L,e)||o(V,e)){var n=k(t,e);return!n||!o(L,e)||o(t,I)&&t[I][e]||(n.enumerable=!0),n}},Q=function(t){for(var e,n=T(b(t)),r=[],i=0;n.length>i;)o(L,e=n[i++])||e==I||e==f||r.push(e);return r},X=function(t){for(var e,n=t===B,r=T(n?V:b(t)),i=[],u=0;r.length>u;)!o(L,e=r[u++])||n&&!o(B,e)||i.push(L[e]);return i};U||(M=function(){if(this instanceof M)throw TypeError("Symbol is not a constructor!");var t=p(arguments.length>0?arguments[0]:void 0),e=function(n){this===B&&e.call(V,n),o(this,I)&&o(this[I],t)&&(this[I][t]=!1),W(this,t,S(1,n))};return i&&G&&W(B,t,{configurable:!0,set:e}),q(t)},a(M[C],"toString",function(){return this._k}),w.f=Z,P.f=J,n(79).f=_.f=Q,n(38).f=z,n(37).f=X,i&&!n(57)&&a(B,"propertyIsEnumerable",z,!0),h.f=function(t){return q(d(t))}),u(u.G+u.W+u.F*!U,{Symbol:M});for(var tt="hasInstance,isConcatSpreadable,iterator,match,replace,search,species,split,toPrimitive,toStringTag,unscopables".split(","),et=0;tt.length>et;)d(tt[et++]);for(var nt=j(d.store),rt=0;nt.length>rt;)v(nt[rt++]);u(u.S+u.F*!U,"Symbol",{for:function(t){return o(D,t+="")?D[t]:D[t]=M(t)},keyFor:function(t){if(!H(t))throw TypeError(t+" is not a symbol!");for(var e in D)if(D[e]===t)return e},useSetter:function(){G=!0},useSimple:function(){G=!1}}),u(u.S+u.F*!U,"Object",{create:$,defineProperty:J,defineProperties:Y,getOwnPropertyDescriptor:Z,getOwnPropertyNames:Q,getOwnPropertySymbols:X}),N&&u(u.S+u.F*(!U||s(function(){var t=M();return"[null]"!=F([t])||"{}"!=F({a:t})||"{}"!=F(Object(t))})),"JSON",{stringify:function(t){if(void 0!==t&&!H(t)){for(var e,n,r=[t],o=1;arguments.length>o;)r.push(arguments[o++]);return e=r[1],"function"==typeof e&&(n=e),!n&&m(e)||(e=function(t,e){if(n&&(e=n.call(this,t,e)),!H(e))return e}),r[1]=e,F.apply(N,r)}}}),M[C][R]||n(11)(M[C],R,M[C].valueOf),l(M,"Symbol"),l(Math,"Math",!0),l(r.JSON,"JSON",!0)},function(t,e,n){var r=n(35)("meta"),o=n(14),i=n(24),u=n(12).f,a=0,f=Object.isExtensible||function(){return!0},s=!n(17)(function(){return f(Object.preventExtensions({}))}),c=function(t){u(t,r,{value:{i:"O"+ ++a,w:{}}})},l=function(t,e){if(!o(t))return"symbol"==typeof t?t:("string"==typeof t?"S":"P")+t;if(!i(t,r)){if(!f(t))return"F";if(!e)return"E";c(t)}return t[r].i},p=function(t,e){if(!i(t,r)){if(!f(t))return!0;if(!e)return!1;c(t)}return t[r].w},d=function(t){return s&&h.NEED&&f(t)&&!i(t,r)&&c(t),t},h=t.exports={KEY:r,NEED:!1,fastKey:l,getWeak:p,onFreeze:d}},function(t,e,n){var r=n(7),o=n(8),i=n(57),u=n(70),a=n(12).f;t.exports=function(t){var e=o.Symbol||(o.Symbol=i?{}:r.Symbol||{});"_"==t.charAt(0)||t in e||a(e,t,{value:u.f(t)})}},function(t,e,n){var r=n(22),o=n(37),i=n(38);t.exports=function(t){var e=r(t),n=o.f;if(n)for(var u,a=n(t),f=i.f,s=0;a.length>s;)f.call(t,u=a[s++])&&e.push(u);return e}},function(t,e,n){var r=n(27);t.exports=Array.isArray||function(t){return"Array"==r(t)}},function(t,e,n){var r=n(25),o=n(79).f,i={}.toString,u="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[],a=function(t){try{return o(t)}catch(t){return u.slice()}};t.exports.f=function(t){return u&&"[object Window]"==i.call(t)?a(t):o(r(t))}},function(t,e,n){var r=n(23),o=n(36).concat("length","prototype");e.f=Object.getOwnPropertyNames||function(t){return r(t,o)}},function(t,e,n){var r=n(38),o=n(20),i=n(25),u=n(19),a=n(24),f=n(15),s=Object.getOwnPropertyDescriptor;e.f=n(16)?s:function(t,e){if(t=i(t),e=u(e,!0),f)try{return s(t,e)}catch(t){}if(a(t,e))return o(!r.f.call(t,e),t[e])}},function(t,e){},function(t,e,n){n(75)("asyncIterator")},function(t,e,n){n(75)("observable")},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}e.__esModule=!0;var o=n(85),i=r(o),u=n(89),a=r(u),f=n(51),s=r(f);e.default=function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+("undefined"==typeof e?"undefined":(0,s.default)(e)));t.prototype=(0,a.default)(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(i.default?(0,i.default)(t,e):t.__proto__=e)}},function(t,e,n){t.exports={default:n(86),__esModule:!0}},function(t,e,n){n(87),t.exports=n(8).Object.setPrototypeOf},function(t,e,n){var r=n(6);r(r.S,"Object",{setPrototypeOf:n(88).set})},function(t,e,n){var r=n(14),o=n(13),i=function(t,e){if(o(t),!r(e)&&null!==e)throw TypeError(e+": can't set as prototype!")};t.exports={set:Object.setPrototypeOf||("__proto__"in{}?function(t,e,r){try{r=n(9)(Function.call,n(80).f(Object.prototype,"__proto__").set,2),r(t,[]),e=!(t instanceof Array)}catch(t){e=!0}return function(t,n){return i(t,n),e?t.__proto__=n:r(t,n),t}}({},!1):void 0),check:i}},function(t,e,n){t.exports={default:n(90),__esModule:!0}},function(t,e,n){n(91);var r=n(8).Object;t.exports=function(t,e){return r.create(t,e)}},function(t,e,n){var r=n(6);r(r.S,"Object",{create:n(61)})},function(t,e,n){t.exports=n(93)()},function(t,e,n){"use strict";var r=n(94),o=n(95),i=n(96);t.exports=function(){function t(t,e,n,r,u,a){a!==i&&o(!1,"Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types")}function e(){return t}t.isRequired=t;var n={array:t,bool:t,func:t,number:t,object:t,string:t,symbol:t,any:t,arrayOf:e,element:t,instanceOf:e,node:t,objectOf:e,oneOf:e,oneOfType:e,shape:e,exact:e};return n.checkPropTypes=r,n.PropTypes=n,n}},function(t,e){"use strict";function n(t){return function(){return t}}var r=function(){};r.thatReturns=n,r.thatReturnsFalse=n(!1),r.thatReturnsTrue=n(!0),r.thatReturnsNull=n(null),r.thatReturnsThis=function(){return this},r.thatReturnsArgument=function(t){return t},t.exports=r},function(t,e,n){"use strict";function r(t,e,n,r,i,u,a,f){if(o(e),!t){var s;if(void 0===e)s=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{
var c=[n,r,i,u,a,f],l=0;s=new Error(e.replace(/%s/g,function(){return c[l++]})),s.name="Invariant Violation"}throw s.framesToPop=1,s}}var o=function(t){};t.exports=r},function(t,e){"use strict";var n="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";t.exports=n},function(e,n){e.exports=t},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function o(){}function i(){return!0}function u(t){return!!(t||"").match(/\d/)}function a(t){return t.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")}function f(t){var e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n="-"===t[0],r=n&&e;t=t.replace("-","");var o=t.split("."),i=o[0],u=o[1]||"";return{beforeDecimal:i,afterDecimal:u,hasNagation:n,addNegation:r}}function s(t){if(!t)return t;var e="-"===t[0];e&&(t=t.substring(1,t.length));var n=t.split("."),r=n[0].replace(/^0+/,"")||"0",o=n[1]||"";return""+(e?"-":"")+r+(o?"."+o:"")}function c(t,e,n){for(var r="",o=n?"0":"",i=0;i<=e-1;i++)r+=t[i]||o;return r}function l(t,e,n){if(["","-"].indexOf(t)!==-1)return t;var r=t.indexOf(".")!==-1&&e,o=f(t),i=o.beforeDecimal,u=o.afterDecimal,a=o.hasNagation,s=parseFloat("0."+(u||"0")).toFixed(e).split("."),l=i.split("").reverse().reduce(function(t,e,n){return t.length>n?(Number(t[0])+Number(e)).toString()+t.substring(1,t.length):e+t},s[0]),p=c(s[1]||"",Math.min(e,u.length),n),d=a?"-":"",h=r?".":"";return""+d+l+h+p}function p(t,e){var n={};return(0,m.default)(t).forEach(function(r){e[r]||(n[r]=t[r])}),n}function d(t,e){if(t.value=t.value,null!==t){if(t.createTextRange){var n=t.createTextRange();return n.move("character",e),n.select(),!0}return t.selectionStart||0===t.selectionStart?(t.focus(),t.setSelectionRange(e,e),!0):(t.focus(),!1)}}function h(t,e){for(var n=0,r=0,o=t.length,i=e.length;t[n]===e[n]&&n<o;)n++;for(;t[o-1-r]===e[i-1-r]&&i-r>n&&o-r>n;)r++;return{start:n,end:o-r}}function v(t,e,n){return Math.min(Math.max(t,e),n)}Object.defineProperty(e,"__esModule",{value:!0});var g=n(99),m=r(g);e.noop=o,e.returnTrue=i,e.charIsNumber=u,e.escapeRegExp=a,e.splitDecimal=f,e.fixLeadingZero=s,e.limitToScale=c,e.roundToPrecision=l,e.omit=p,e.setCaretPosition=d,e.findChangedIndex=h,e.clamp=v},function(t,e,n){t.exports={default:n(100),__esModule:!0}},function(t,e,n){n(101),t.exports=n(8).Object.keys},function(t,e,n){var r=n(39),o=n(22);n(44)("keys",function(){return function(t){return o(r(t))}})}])});
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("react")):"function"==typeof define&&define.amd?define(["react"],t):e.NumberFormat=t(e.React)}(this,function(h){"use strict";function o(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function g(){return(g=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}).apply(this,arguments)}function i(e){return(i=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function s(e,t){return(s=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function u(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function e(e){return function(){return e}}h=h&&h.hasOwnProperty("default")?h.default:h;var t=function(){};t.thatReturns=e,t.thatReturnsFalse=e(!1),t.thatReturnsTrue=e(!0),t.thatReturnsNull=e(null),t.thatReturnsThis=function(){return this},t.thatReturnsArgument=function(e){return e};var n=t;var c=function(e,t,r,n,o,a,i,s){if(!e){var u;if(void 0===t)u=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var c=[r,n,o,a,i,s],l=0;(u=new Error(t.replace(/%s/g,function(){return c[l++]}))).name="Invariant Violation"}throw u.framesToPop=1,u}},r=Object.getOwnPropertySymbols,a=Object.prototype.hasOwnProperty,l=Object.prototype.propertyIsEnumerable;(function(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var t={},r=0;r<10;r++)t["_"+String.fromCharCode(r)]=r;if("0123456789"!==Object.getOwnPropertyNames(t).map(function(e){return t[e]}).join(""))return!1;var n={};return"abcdefghijklmnopqrst".split("").forEach(function(e){n[e]=e}),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},n)).join("")}catch(e){return!1}})()&&Object.assign;var f,p=(function(e){e.exports=function(){function e(e,t,r,n,o,a){"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"!==a&&c(!1,"Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types")}function t(){return e}var r={array:e.isRequired=e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t};return r.checkPropTypes=n,r.PropTypes=r}()}(f={exports:{}},f.exports),f.exports);function m(){}function v(e){return!!(e||"").match(/\d/)}function d(e){return e.replace(/[-[\]/{}()*+?.\\^$|]/g,"\\$&")}function S(e){var t=!(1<arguments.length&&void 0!==arguments[1])||arguments[1],r="-"===e[0],n=r&&t,o=(e=e.replace("-","")).split(".");return{beforeDecimal:o[0],afterDecimal:o[1]||"",hasNagation:r,addNegation:n}}function y(e,t,r){for(var n="",o=r?"0":"",a=0;a<=t-1;a++)n+=e[a]||o;return n}function b(e,t){if(e.value=e.value,null!==e){if(e.createTextRange){var r=e.createTextRange();return r.move("character",t),r.select(),!0}return e.selectionStart||0===e.selectionStart?(e.focus(),e.setSelectionRange(t,t),!0):(e.focus(),!1)}}function x(e,t,r){return Math.min(Math.max(e,t),r)}var O={thousandSeparator:p.oneOfType([p.string,p.oneOf([!0])]),decimalSeparator:p.string,decimalScale:p.number,fixedDecimalScale:p.bool,displayType:p.oneOf(["input","text"]),prefix:p.string,suffix:p.string,format:p.oneOfType([p.string,p.func]),removeFormatting:p.func,mask:p.oneOfType([p.string,p.arrayOf(p.string)]),value:p.oneOfType([p.number,p.string]),isNumericString:p.bool,customInput:p.func,allowNegative:p.bool,allowEmptyFormatting:p.bool,onValueChange:p.func,onKeyDown:p.func,onMouseUp:p.func,onChange:p.func,onFocus:p.func,onBlur:p.func,type:p.oneOf(["text","tel"]),isAllowed:p.func,renderText:p.func,getInputRef:p.func},w={displayType:"input",decimalSeparator:".",fixedDecimalScale:!1,prefix:"",suffix:"",allowNegative:!0,allowEmptyFormatting:!1,isNumericString:!1,type:"text",onValueChange:m,onChange:m,onKeyDown:m,onMouseUp:m,onFocus:m,onBlur:m,isAllowed:function(){return!0},getInputRef:m},P=function(e){function a(e){var t,r,n;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,a),r=this,(t=!(n=i(a).call(this,e))||"object"!=typeof n&&"function"!=typeof n?u(r):n).validateProps();var o=t.formatValueProp();return t.state={value:o,numAsString:t.removeFormatting(o)},t.selectionBeforeInput={selectionStart:0,selectionEnd:0},t.onChange=t.onChange.bind(u(u(t))),t.onKeyDown=t.onKeyDown.bind(u(u(t))),t.onMouseUp=t.onMouseUp.bind(u(u(t))),t.onFocus=t.onFocus.bind(u(u(t))),t.onBlur=t.onBlur.bind(u(u(t))),t}var t,r,n;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&s(e,t)}(a,h.Component),t=a,(r=[{key:"componentDidUpdate",value:function(e){this.updateValueIfRequired(e)}},{key:"updateValueIfRequired",value:function(e){var t=this.props,r=this.state;if(e!==t){this.validateProps();var n=r.value,o=r.numAsString||"",a=this.formatNumString(o),i=void 0===t.value?a:this.formatValueProp(),s=this.removeFormatting(i),u=parseFloat(s),c=parseFloat(o);(isNaN(u)&&isNaN(c)||u===c)&&a===n||this.setState({value:i,numAsString:s})}}},{key:"getFloatString",value:function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:"",t=this.props.decimalScale,r=this.getSeparators().decimalSeparator,n=this.getNumberRegex(!0),o="-"===e[0];o&&(e=e.replace("-","")),r&&0===t&&(e=e.split(r)[0]);var a=(e=(e.match(n)||[]).join("").replace(r,".")).indexOf(".");return-1!==a&&(e="".concat(e.substring(0,a),".").concat(e.substring(a+1,e.length).replace(new RegExp(d(r),"g"),""))),o&&(e="-"+e),e}},{key:"getNumberRegex",value:function(e,t){var r=this.props,n=r.format,o=r.decimalScale,a=this.getSeparators().decimalSeparator;return new RegExp("\\d"+(!a||0===o||t||n?"":"|"+d(a)),e?"g":void 0)}},{key:"getSeparators",value:function(){var e=this.props.decimalSeparator,t=this.props.thousandSeparator;return!0===t&&(t=","),{decimalSeparator:e,thousandSeparator:t}}},{key:"getMaskAtIndex",value:function(e){var t=this.props.mask,r=void 0===t?" ":t;return"string"==typeof r?r:r[e]||" "}},{key:"getValueObject",value:function(e,t){var r=parseFloat(t);return{formattedValue:e,value:t,floatValue:isNaN(r)?void 0:r}}},{key:"validateProps",value:function(){var e=this.props.mask,t=this.getSeparators(),r=t.decimalSeparator,n=t.thousandSeparator;if(r===n)throw new Error("\n Decimal separator can't be same as thousand separator.\n thousandSeparator: ".concat(n,' (thousandSeparator = {true} is same as thousandSeparator = ",")\n decimalSeparator: ').concat(r," (default value for decimalSeparator is .)\n "));if(e&&("string"===e?e:e.toString()).match(/\d/g))throw new Error("\n Mask ".concat(e," should not contain numeric character;\n "))}},{key:"setPatchedCaretPosition",value:function(e,t,r){b(e,t),setTimeout(function(){e.value===r&&b(e,t)},0)}},{key:"correctCaretPosition",value:function(e,t,r){var n=this.props,o=n.prefix,a=n.suffix,i=n.format;if(""===e)return 0;if(t=x(t,0,e.length),!i){var s="-"===e[0];return x(t,o.length+(s?1:0),e.length-a.length)}if("function"==typeof i)return t;if("#"===i[t]&&v(e[t]))return t;if("#"===i[t-1]&&v(e[t-1]))return t;var u=i.indexOf("#");t=x(t,u,i.lastIndexOf("#")+1);for(var c=i.substring(t,i.length).indexOf("#"),l=t,f=t+(-1===c?0:c);u<l&&("#"!==i[l]||!v(e[l]));)l-=1;return!v(e[f])||"left"===r&&t!==u||t-l<f-t?v(e[l])?l+1:l:f}},{key:"getCaretPosition",value:function(e,t,r){var n,o,a=this.props.format,i=this.state.value,s=this.getNumberRegex(!0),u=(e.match(s)||[]).join(""),c=(t.match(s)||[]).join("");for(o=n=0;o<r;o++){var l=e[o]||"",f=t[n]||"";if((l.match(s)||l===f)&&("0"!==l||!f.match(s)||"0"===f||u.length===c.length)){for(;l!==t[n]&&n<t.length;)n++;n++}}return"string"!=typeof a||i||(n=t.length),n=this.correctCaretPosition(t,n)}},{key:"removePrefixAndSuffix",value:function(e){var t=this.props,r=t.format,n=t.prefix,o=t.suffix;if(!r&&e){var a="-"===e[0];a&&(e=e.substring(1,e.length));var i=(e=n&&0===e.indexOf(n)?e.substring(n.length,e.length):e).lastIndexOf(o);e=o&&-1!==i&&i===e.length-o.length?e.substring(0,i):e,a&&(e="-"+e)}return e}},{key:"removePatternFormatting",value:function(e){for(var t=this.props.format.split("#").filter(function(e){return""!==e}),r=0,n="",o=0,a=t.length;o<=a;o++){var i=t[o]||"",s=o===a?e.length:e.indexOf(i,r);if(-1===s){n=e;break}n+=e.substring(r,s),r=s+i.length}return(n.match(/\d/g)||[]).join("")}},{key:"removeFormatting",value:function(e){var t=this.props,r=t.format,n=t.removeFormatting;return e?e=r?"string"==typeof r?this.removePatternFormatting(e):"function"==typeof n?n(e):(e.match(/\d/g)||[]).join(""):(e=this.removePrefixAndSuffix(e),this.getFloatString(e)):e}},{key:"formatWithPattern",value:function(e){for(var t=this.props.format,r=0,n=t.split(""),o=0,a=t.length;o<a;o++)"#"===t[o]&&(n[o]=e[r]||this.getMaskAtIndex(r),r+=1);return n.join("")}},{key:"formatAsNumber",value:function(e){var t=this.props,r=t.decimalScale,n=t.fixedDecimalScale,o=t.prefix,a=t.suffix,i=t.allowNegative,s=this.getSeparators(),u=s.thousandSeparator,c=s.decimalSeparator,l=-1!==e.indexOf(".")||r&&n,f=S(e,i),p=f.beforeDecimal,h=f.afterDecimal,g=f.addNegation;return void 0!==r&&(h=y(h,r,n)),u&&(p=p.replace(/(\d)(?=(\d{3})+(?!\d))/g,"$1"+u)),o&&(p=o+p),a&&(h+=a),g&&(p="-"+p),e=p+(l&&c||"")+h}},{key:"formatNumString",value:function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:"",t=this.props,r=t.format,n=t.allowEmptyFormatting,o=e;return""!==e||n?"-"!==e||r?o="string"==typeof r?this.formatWithPattern(o):"function"==typeof r?r(o):this.formatAsNumber(o):(o="-",e=""):o="",o}},{key:"formatValueProp",value:function(){var e=this.props,t=e.format,r=e.decimalScale,n=e.fixedDecimalScale,o=e.allowEmptyFormatting,a=this.props,i=a.value,s=a.isNumericString,u=!i&&0!==i;return u&&o&&(i=""),u&&!o?"":("number"==typeof i&&(i=i.toString(),s=!0),s&&!t&&"number"==typeof r&&(i=function(e,t,r){if(-1!==["","-"].indexOf(e))return e;var n=-1!==e.indexOf(".")&&t,o=S(e),a=o.beforeDecimal,i=o.afterDecimal,s=o.hasNagation,u=parseFloat("0.".concat(i||"0")).toFixed(t).split("."),c=a.split("").reverse().reduce(function(e,t,r){return e.length>r?(Number(e[0])+Number(t)).toString()+e.substring(1,e.length):t+e},u[0]),l=y(u[1]||"",Math.min(t,i.length),r),f=n?".":"";return"".concat(s?"-":"").concat(c).concat(f).concat(l)}(i,r,n)),s?this.formatNumString(i):this.formatInput(i))}},{key:"formatNegation",value:function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:"",t=this.props.allowNegative,r=new RegExp("(-)"),n=new RegExp("(-)(.)*(-)"),o=r.test(e),a=n.test(e);return e=e.replace(/-/g,""),o&&!a&&t&&(e="-"+e),e}},{key:"formatInput",value:function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:"";return this.props.format||(e=this.formatNegation(e)),e=this.removeFormatting(e),this.formatNumString(e)}},{key:"isCharacterAFormat",value:function(e,t){var r=this.props,n=r.format,o=r.prefix,a=r.suffix,i=r.decimalScale,s=r.fixedDecimalScale,u=this.getSeparators().decimalSeparator;return"string"==typeof n&&"#"!==n[e]||!(n||!(e<o.length||e>=t.length-a.length||i&&s&&t[e]===u))}},{key:"checkIfFormatGotDeleted",value:function(e,t,r){for(var n=e;n<t;n++)if(this.isCharacterAFormat(n,r))return!0;return!1}},{key:"correctInputValue",value:function(e,t,r){var n=this.props,o=n.format,a=n.decimalSeparator,i=n.allowNegative,s=this.state.numAsString||"",u=this.selectionBeforeInput,c=u.selectionStart,l=u.selectionEnd,f=function(e,t){for(var r=0,n=0,o=e.length,a=t.length;e[r]===t[r]&&r<o;)r++;for(;e[o-1-n]===t[a-1-n]&&r<a-n&&r<o-n;)n++;return{start:r,end:o-n}}(t,r),p=f.start,h=f.end;if(r.length>t.length||!r.length||p===h||0===p&&h===t.length||0===c&&l===t.length)return r;if(this.checkIfFormatGotDeleted(p,h,t)&&(r=t),!o){var g=this.removeFormatting(r),m=S(g,i),v=m.beforeDecimal,d=m.afterDecimal,y=m.addNegation,b=e<r.indexOf(a)+1;if(g.length<s.length&&b&&""===v&&!parseFloat(d))return y?"-":""}return r}},{key:"onChange",value:function(e){e.persist();var t=e.target,r=t.value,n=this.state,o=this.props,a=o.isAllowed,i=n.value||"",s=Math.max(t.selectionStart,t.selectionEnd);r=this.correctInputValue(s,i,r);var u=this.formatInput(r)||"",c=this.removeFormatting(u),l=this.getValueObject(u,c);a(l)||(u=i),t.value=u;var f=this.getCaretPosition(r,u,s);this.setPatchedCaretPosition(t,f,u),u!==i?this.setState({value:u,numAsString:c},function(){o.onValueChange(l,e),o.onChange(e)}):o.onChange(e)}},{key:"onBlur",value:function(t){var r=this,n=this.props,e=this.state,o=n.format,a=n.onBlur,i=e.numAsString,s=e.value;if(!o){i=function(e){if(!e)return e;var t="-"===e[0];t&&(e=e.substring(1,e.length));var r=e.split("."),n=r[0].replace(/^0+/,"")||"0",o=r[1]||"";return"".concat(t?"-":"").concat(n).concat(o?".".concat(o):"")}(i);var u=this.formatNumString(i);if(u!==s)return t.persist(),void this.setState({value:u,numAsString:i},function(){var e=r.getValueObject(u,i);n.onValueChange(e,t),a(t)})}a(t)}},{key:"onKeyDown",value:function(e){var t,r=this,n=e.target,o=e.key,a=n.selectionStart,i=n.selectionEnd,s=n.value,u=void 0===s?"":s,c=this.props,l=c.decimalScale,f=c.fixedDecimalScale,p=c.prefix,h=c.suffix,g=c.format,m=c.onKeyDown,v=c.onValueChange,d=void 0!==l&&f,y=this.getNumberRegex(!1,d),b=new RegExp("-"),S="string"==typeof g;if(this.selectionBeforeInput={selectionStart:a,selectionEnd:i},"ArrowLeft"===o||"Backspace"===o?t=a-1:"ArrowRight"===o?t=a+1:"Delete"===o&&(t=a),void 0!==t&&a===i){var x=t,O=S?g.indexOf("#"):p.length,w=S?g.lastIndexOf("#")+1:u.length-h.length;if("ArrowLeft"===o||"ArrowRight"===o){var P="ArrowLeft"===o?"left":"right";x=this.correctCaretPosition(u,t,P)}else if("Delete"!==o||y.test(u[t])||b.test(u[t])){if("Backspace"===o&&!y.test(u[t]))if(a<=O+1&&"-"===u[0]&&void 0===g){var k=u.substring(1),N=this.removeFormatting(k),F=this.getValueObject(k,N);e.persist(),this.setState({value:k,numAsString:N},function(){r.setPatchedCaretPosition(n,x,k),v(F,e)})}else if(!b.test(u[t])){for(;!y.test(u[x-1])&&O<x;)x--;x=this.correctCaretPosition(u,x,"left")}}else for(;!y.test(u[x])&&x<w;)x++;(x!==t||t<O||w<t)&&(e.preventDefault(),this.setPatchedCaretPosition(n,x,u)),e.isUnitTestRun&&this.setPatchedCaretPosition(n,x,u),this.props.onKeyDown(e)}else m(e)}},{key:"onMouseUp",value:function(e){var t=e.target,r=t.selectionStart,n=t.selectionEnd,o=t.value,a=void 0===o?"":o;if(r===n){var i=this.correctCaretPosition(a,r);i!==r&&this.setPatchedCaretPosition(t,i,a)}this.props.onMouseUp(e)}},{key:"onFocus",value:function(i){var s=this;i.persist(),setTimeout(function(){var e=i.target,t=e.selectionStart,r=e.selectionEnd,n=e.value,o=void 0===n?"":n,a=s.correctCaretPosition(o,t);a===t||0===t&&r===o.length||s.setPatchedCaretPosition(e,a,o),s.props.onFocus(i)},0)}},{key:"render",value:function(){var t,r,n,e=this.props,o=e.type,a=e.displayType,i=e.customInput,s=e.renderText,u=e.getInputRef,c=this.state.value,l=(t=this.props,r=O,n={},Object.keys(t).forEach(function(e){r[e]||(n[e]=t[e])}),n),f=Object.assign({},l,{type:o,value:c,onChange:this.onChange,onKeyDown:this.onKeyDown,onMouseUp:this.onMouseUp,onFocus:this.onFocus,onBlur:this.onBlur});if("text"===a)return s?s(c)||null:h.createElement("span",g({},l,{ref:u}),c);if(i){var p=i;return h.createElement(p,f)}return h.createElement("input",g({},f,{ref:u}))}}])&&o(t.prototype,r),n&&o(t,n),a}();return P.propTypes=O,P.defaultProps=w,P});

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

'use strict';
"use strict";

@@ -6,68 +6,59 @@ Object.defineProperty(exports, "__esModule", {

});
exports.default = void 0;
var _extends2 = require('babel-runtime/helpers/extends');
var _propTypes = _interopRequireDefault(require("prop-types"));
var _extends3 = _interopRequireDefault(_extends2);
var _react = _interopRequireDefault(require("react"));
var _getPrototypeOf = require('babel-runtime/core-js/object/get-prototype-of');
var _utils = require("./utils");
var _getPrototypeOf2 = _interopRequireDefault(_getPrototypeOf);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var _classCallCheck2 = require('babel-runtime/helpers/classCallCheck');
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
var _createClass2 = require('babel-runtime/helpers/createClass');
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
var _createClass3 = _interopRequireDefault(_createClass2);
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
var _possibleConstructorReturn2 = require('babel-runtime/helpers/possibleConstructorReturn');
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
var _inherits2 = require('babel-runtime/helpers/inherits');
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
var _inherits3 = _interopRequireDefault(_inherits2);
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
var _propTypes = require('prop-types');
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
var _propTypes2 = _interopRequireDefault(_propTypes);
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _utils = require('./utils');
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var propTypes = {
thousandSeparator: _propTypes2.default.oneOfType([_propTypes2.default.string, _propTypes2.default.oneOf([true])]),
decimalSeparator: _propTypes2.default.string,
decimalScale: _propTypes2.default.number,
fixedDecimalScale: _propTypes2.default.bool,
displayType: _propTypes2.default.oneOf(['input', 'text']),
prefix: _propTypes2.default.string,
suffix: _propTypes2.default.string,
format: _propTypes2.default.oneOfType([_propTypes2.default.string, _propTypes2.default.func]),
removeFormatting: _propTypes2.default.func,
mask: _propTypes2.default.oneOfType([_propTypes2.default.string, _propTypes2.default.arrayOf(_propTypes2.default.string)]),
value: _propTypes2.default.oneOfType([_propTypes2.default.number, _propTypes2.default.string]),
isNumericString: _propTypes2.default.bool,
customInput: _propTypes2.default.func,
allowNegative: _propTypes2.default.bool,
allowEmptyFormatting: _propTypes2.default.bool,
onValueChange: _propTypes2.default.func,
onKeyDown: _propTypes2.default.func,
onMouseUp: _propTypes2.default.func,
onChange: _propTypes2.default.func,
onFocus: _propTypes2.default.func,
onBlur: _propTypes2.default.func,
type: _propTypes2.default.oneOf(['text', 'tel']),
isAllowed: _propTypes2.default.func,
renderText: _propTypes2.default.func,
getInputRef: _propTypes2.default.func
thousandSeparator: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.oneOf([true])]),
decimalSeparator: _propTypes.default.string,
decimalScale: _propTypes.default.number,
fixedDecimalScale: _propTypes.default.bool,
displayType: _propTypes.default.oneOf(['input', 'text']),
prefix: _propTypes.default.string,
suffix: _propTypes.default.string,
format: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.func]),
removeFormatting: _propTypes.default.func,
mask: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.arrayOf(_propTypes.default.string)]),
value: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]),
isNumericString: _propTypes.default.bool,
customInput: _propTypes.default.func,
allowNegative: _propTypes.default.bool,
allowEmptyFormatting: _propTypes.default.bool,
onValueChange: _propTypes.default.func,
onKeyDown: _propTypes.default.func,
onMouseUp: _propTypes.default.func,
onChange: _propTypes.default.func,
onFocus: _propTypes.default.func,
onBlur: _propTypes.default.func,
type: _propTypes.default.oneOf(['text', 'tel']),
isAllowed: _propTypes.default.func,
renderText: _propTypes.default.func,
getInputRef: _propTypes.default.func
};
var defaultProps = {

@@ -93,11 +84,14 @@ displayType: 'input',

var NumberFormat = function (_React$Component) {
(0, _inherits3.default)(NumberFormat, _React$Component);
var NumberFormat =
/*#__PURE__*/
function (_React$Component) {
_inherits(NumberFormat, _React$Component);
function NumberFormat(props) {
(0, _classCallCheck3.default)(this, NumberFormat);
var _this;
//validate props
var _this = (0, _possibleConstructorReturn3.default)(this, (NumberFormat.__proto__ || (0, _getPrototypeOf2.default)(NumberFormat)).call(this, props));
_classCallCheck(this, NumberFormat);
_this = _possibleConstructorReturn(this, _getPrototypeOf(NumberFormat).call(this, props)); //validate props
_this.validateProps();

@@ -111,3 +105,2 @@

};
_this.selectionBeforeInput = {

@@ -117,13 +110,12 @@ selectionStart: 0,

};
_this.onChange = _this.onChange.bind(_this);
_this.onKeyDown = _this.onKeyDown.bind(_this);
_this.onMouseUp = _this.onMouseUp.bind(_this);
_this.onFocus = _this.onFocus.bind(_this);
_this.onBlur = _this.onBlur.bind(_this);
_this.onChange = _this.onChange.bind(_assertThisInitialized(_assertThisInitialized(_this)));
_this.onKeyDown = _this.onKeyDown.bind(_assertThisInitialized(_assertThisInitialized(_this)));
_this.onMouseUp = _this.onMouseUp.bind(_assertThisInitialized(_assertThisInitialized(_this)));
_this.onFocus = _this.onFocus.bind(_assertThisInitialized(_assertThisInitialized(_this)));
_this.onBlur = _this.onBlur.bind(_assertThisInitialized(_assertThisInitialized(_this)));
return _this;
}
(0, _createClass3.default)(NumberFormat, [{
key: 'componentDidUpdate',
_createClass(NumberFormat, [{
key: "componentDidUpdate",
value: function componentDidUpdate(prevProps) {

@@ -133,3 +125,3 @@ this.updateValueIfRequired(prevProps);

}, {
key: 'updateValueIfRequired',
key: "updateValueIfRequired",
value: function updateValueIfRequired(prevProps) {

@@ -139,16 +131,11 @@ var props = this.props,

if (prevProps !== props) {
//validate props
this.validateProps();
var stateValue = state.value;
var lastNumStr = state.numAsString || '';
var lastValueWithNewFormat = this.formatNumString(lastNumStr);
var formattedValue = props.value === undefined ? lastValueWithNewFormat : this.formatValueProp();
var _numAsString = this.removeFormatting(formattedValue);
var floatValue = parseFloat(_numAsString);
var numAsString = this.removeFormatting(formattedValue);
var floatValue = parseFloat(numAsString);
var lastFloatValue = parseFloat(lastNumStr);

@@ -159,3 +146,3 @@

value: formattedValue,
numAsString: _numAsString
numAsString: numAsString
});

@@ -165,7 +152,6 @@ }

}
/** Misc methods **/
}, {
key: 'getFloatString',
key: "getFloatString",
value: function getFloatString() {

@@ -175,12 +161,10 @@ var num = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';

var _getSeparators = this.getSeparators(),
decimalSeparator = _getSeparators.decimalSeparator;
var _this$getSeparators = this.getSeparators(),
decimalSeparator = _this$getSeparators.decimalSeparator;
var numRegex = this.getNumberRegex(true);
var numRegex = this.getNumberRegex(true); //remove negation for regex check
//remove negation for regex check
var hasNegation = num[0] === '-';
if (hasNegation) num = num.replace('-', '');
if (hasNegation) num = num.replace('-', ''); //if decimal scale is zero remove decimal and number after decimalSeparator
//if decimal scale is zero remove decimal and number after decimalSeparator
if (decimalSeparator && decimalScale === 0) {

@@ -190,28 +174,24 @@ num = num.split(decimalSeparator)[0];

num = (num.match(numRegex) || []).join('').replace(decimalSeparator, '.');
num = (num.match(numRegex) || []).join('').replace(decimalSeparator, '.'); //remove extra decimals
//remove extra decimals
var firstDecimalIndex = num.indexOf('.');
if (firstDecimalIndex !== -1) {
num = num.substring(0, firstDecimalIndex) + '.' + num.substring(firstDecimalIndex + 1, num.length).replace(new RegExp((0, _utils.escapeRegExp)(decimalSeparator), 'g'), '');
}
num = "".concat(num.substring(0, firstDecimalIndex), ".").concat(num.substring(firstDecimalIndex + 1, num.length).replace(new RegExp((0, _utils.escapeRegExp)(decimalSeparator), 'g'), ''));
} //add negation back
//add negation back
if (hasNegation) num = '-' + num;
return num;
}
} //returned regex assumes decimalSeparator is as per prop
//returned regex assumes decimalSeparator is as per prop
}, {
key: 'getNumberRegex',
key: "getNumberRegex",
value: function getNumberRegex(g, ignoreDecimalSeparator) {
var _props = this.props,
format = _props.format,
decimalScale = _props.decimalScale;
var _this$props = this.props,
format = _this$props.format,
decimalScale = _this$props.decimalScale;
var _getSeparators2 = this.getSeparators(),
decimalSeparator = _getSeparators2.decimalSeparator;
var _this$getSeparators2 = this.getSeparators(),
decimalSeparator = _this$getSeparators2.decimalSeparator;

@@ -221,3 +201,3 @@ return new RegExp('\\d' + (decimalSeparator && decimalScale !== 0 && !ignoreDecimalSeparator && !format ? '|' + (0, _utils.escapeRegExp)(decimalSeparator) : ''), g ? 'g' : undefined);

}, {
key: 'getSeparators',
key: "getSeparators",
value: function getSeparators() {

@@ -227,3 +207,2 @@ var decimalSeparator = this.props.decimalSeparator;

if (thousandSeparator === true) {

@@ -239,6 +218,6 @@ thousandSeparator = ',';

}, {
key: 'getMaskAtIndex',
key: "getMaskAtIndex",
value: function getMaskAtIndex(index) {
var _props$mask = this.props.mask,
mask = _props$mask === undefined ? ' ' : _props$mask;
var _this$props$mask = this.props.mask,
mask = _this$props$mask === void 0 ? ' ' : _this$props$mask;

@@ -252,6 +231,5 @@ if (typeof mask === 'string') {

}, {
key: 'getValueObject',
key: "getValueObject",
value: function getValueObject(formattedValue, numAsString) {
var floatValue = parseFloat(numAsString);
return {

@@ -264,21 +242,20 @@ formattedValue: formattedValue,

}, {
key: 'validateProps',
key: "validateProps",
value: function validateProps() {
var mask = this.props.mask;
var mask = this.props.mask; //validate decimalSeparator and thousandSeparator
//validate decimalSeparator and thousandSeparator
var _this$getSeparators3 = this.getSeparators(),
decimalSeparator = _this$getSeparators3.decimalSeparator,
thousandSeparator = _this$getSeparators3.thousandSeparator;
var _getSeparators3 = this.getSeparators(),
decimalSeparator = _getSeparators3.decimalSeparator,
thousandSeparator = _getSeparators3.thousandSeparator;
if (decimalSeparator === thousandSeparator) {
throw new Error('\n Decimal separator can\'t be same as thousand separator.\n\n thousandSeparator: ' + thousandSeparator + ' (thousandSeparator = {true} is same as thousandSeparator = ",")\n decimalSeparator: ' + decimalSeparator + ' (default value for decimalSeparator is .)\n ');
}
throw new Error("\n Decimal separator can't be same as thousand separator.\n thousandSeparator: ".concat(thousandSeparator, " (thousandSeparator = {true} is same as thousandSeparator = \",\")\n decimalSeparator: ").concat(decimalSeparator, " (default value for decimalSeparator is .)\n "));
} //validate mask
//validate mask
if (mask) {
var maskAsStr = mask === 'string' ? mask : mask.toString();
if (maskAsStr.match(/\d/g)) {
throw new Error('\n Mask ' + mask + ' should not contain numeric character;\n ');
throw new Error("\n Mask ".concat(mask, " should not contain numeric character;\n "));
}

@@ -292,3 +269,3 @@ }

}, {
key: 'setPatchedCaretPosition',
key: "setPatchedCaretPosition",
value: function setPatchedCaretPosition(el, caretPos, currentValue) {

@@ -303,49 +280,38 @@ /* setting caret position within timeout of 0ms is required for mobile chrome,

}
/* This keeps the caret within typing area so people can't type in between prefix or suffix */
}, {
key: 'correctCaretPosition',
key: "correctCaretPosition",
value: function correctCaretPosition(value, caretPos, direction) {
var _props2 = this.props,
prefix = _props2.prefix,
suffix = _props2.suffix,
format = _props2.format;
var _this$props2 = this.props,
prefix = _this$props2.prefix,
suffix = _this$props2.suffix,
format = _this$props2.format; //if value is empty return 0
//if value is empty return 0
if (value === '') return 0; //caret position should be between 0 and value length
if (value === '') return 0;
caretPos = (0, _utils.clamp)(caretPos, 0, value.length); //in case of format as number limit between prefix and suffix
//caret position should be between 0 and value length
caretPos = (0, _utils.clamp)(caretPos, 0, value.length);
//in case of format as number limit between prefix and suffix
if (!format) {
var hasNegation = value[0] === '-';
return (0, _utils.clamp)(caretPos, prefix.length + (hasNegation ? 1 : 0), value.length - suffix.length);
}
} //in case if custom format method don't do anything
//in case if custom format method don't do anything
if (typeof format === 'function') return caretPos;
/* in case format is string find the closest # position from the caret position */
//in case the caretPos have input value on it don't do anything
if (format[caretPos] === '#' && (0, _utils.charIsNumber)(value[caretPos])) return caretPos;
//if caretPos is just after input value don't do anything
if (format[caretPos - 1] === '#' && (0, _utils.charIsNumber)(value[caretPos - 1])) return caretPos;
if (format[caretPos] === '#' && (0, _utils.charIsNumber)(value[caretPos])) return caretPos; //if caretPos is just after input value don't do anything
//find the nearest caret position
if (format[caretPos - 1] === '#' && (0, _utils.charIsNumber)(value[caretPos - 1])) return caretPos; //find the nearest caret position
var firstHashPosition = format.indexOf('#');
var lastHashPosition = format.lastIndexOf('#');
var lastHashPosition = format.lastIndexOf('#'); //limit the cursor between the first # position and the last # position
//limit the cursor between the first # position and the last # position
caretPos = (0, _utils.clamp)(caretPos, firstHashPosition, lastHashPosition + 1);
var nextPos = format.substring(caretPos, format.length).indexOf('#');
var caretLeftBound = caretPos;
var caretRightBound = caretPos + (nextPos === -1 ? 0 : nextPos);
var caretRightBound = caretPos + (nextPos === -1 ? 0 : nextPos); //get the position where the last number is present
//get the position where the last number is present
while (caretLeftBound > firstHashPosition && (format[caretLeftBound] !== '#' || !(0, _utils.charIsNumber)(value[caretLeftBound]))) {

@@ -366,6 +332,5 @@ caretLeftBound -= 1;

}, {
key: 'getCaretPosition',
key: "getCaretPosition",
value: function getCaretPosition(inputValue, formattedValue, caretPos) {
var format = this.props.format;
var stateValue = this.state.value;

@@ -375,5 +340,3 @@ var numRegex = this.getNumberRegex(true);

var formattedNumber = (formattedValue.match(numRegex) || []).join('');
var j = void 0,
i = void 0;
var j, i;
j = 0;

@@ -383,15 +346,15 @@

var currentInputChar = inputValue[i] || '';
var currentFormatChar = formattedValue[j] || '';
//no need to increase new cursor position if formatted value does not have those characters
var currentFormatChar = formattedValue[j] || ''; //no need to increase new cursor position if formatted value does not have those characters
//case inputValue = 1a23 and formattedValue = 123
if (!currentInputChar.match(numRegex) && currentInputChar !== currentFormatChar) continue;
//When we are striping out leading zeros maintain the new cursor position
if (!currentInputChar.match(numRegex) && currentInputChar !== currentFormatChar) continue; //When we are striping out leading zeros maintain the new cursor position
//Case inputValue = 00023 and formattedValue = 23;
if (currentInputChar === '0' && currentFormatChar.match(numRegex) && currentFormatChar !== '0' && inputNumber.length !== formattedNumber.length) continue;
//we are not using currentFormatChar because j can change here
if (currentInputChar === '0' && currentFormatChar.match(numRegex) && currentFormatChar !== '0' && inputNumber.length !== formattedNumber.length) continue; //we are not using currentFormatChar because j can change here
while (currentInputChar !== formattedValue[j] && j < formattedValue.length) {
j++;
}j++;
}
j++;
}

@@ -402,7 +365,6 @@

j = formattedValue.length;
}
} //correct caret position if its outside of editable area
//correct caret position if its outside of editable area
j = this.correctCaretPosition(formattedValue, j);
return j;

@@ -415,25 +377,19 @@ }

}, {
key: 'removePrefixAndSuffix',
key: "removePrefixAndSuffix",
value: function removePrefixAndSuffix(val) {
var _props3 = this.props,
format = _props3.format,
prefix = _props3.prefix,
suffix = _props3.suffix;
var _this$props3 = this.props,
format = _this$props3.format,
prefix = _this$props3.prefix,
suffix = _this$props3.suffix; //remove prefix and suffix
//remove prefix and suffix
if (!format && val) {
var isNegative = val[0] === '-';
var isNegative = val[0] === '-'; //remove negation sign
//remove negation sign
if (isNegative) val = val.substring(1, val.length);
if (isNegative) val = val.substring(1, val.length); //remove prefix
//remove prefix
val = prefix && val.indexOf(prefix) === 0 ? val.substring(prefix.length, val.length) : val;
val = prefix && val.indexOf(prefix) === 0 ? val.substring(prefix.length, val.length) : val; //remove suffix
//remove suffix
var suffixLastIndex = val.lastIndexOf(suffix);
val = suffix && suffixLastIndex !== -1 && suffixLastIndex === val.length - suffix.length ? val.substring(0, suffixLastIndex) : val;
val = suffix && suffixLastIndex !== -1 && suffixLastIndex === val.length - suffix.length ? val.substring(0, suffixLastIndex) : val; //add negation sign back
//add negation sign back
if (isNegative) val = '-' + val;

@@ -445,6 +401,5 @@ }

}, {
key: 'removePatternFormatting',
key: "removePatternFormatting",
value: function removePatternFormatting(val) {
var format = this.props.format;
var formatArray = format.split('#').filter(function (str) {

@@ -457,11 +412,10 @@ return str !== '';

for (var i = 0, ln = formatArray.length; i <= ln; i++) {
var part = formatArray[i] || '';
var part = formatArray[i] || ''; //if i is the last fragment take the index of end of the value
//For case like +1 (911) 911 91 91 having pattern +1 (###) ### ## ##
//if i is the last fragment take the index of end of the value
//For case like +1 (911) 911 91 91 having pattern +1 (###) ### ## ##
var index = i === ln ? val.length : val.indexOf(part, start);
/* in any case if we don't find the pattern part in the value assume the val as numeric string
This will be also in case if user has started typing, in any other case it will not be -1
unless wrong prop value is provided */
if (index === -1) {

@@ -479,8 +433,7 @@ numStr = val;

}, {
key: 'removeFormatting',
key: "removeFormatting",
value: function removeFormatting(val) {
var _props4 = this.props,
format = _props4.format,
removeFormatting = _props4.removeFormatting;
var _this$props4 = this.props,
format = _this$props4.format,
removeFormatting = _this$props4.removeFormatting;
if (!val) return val;

@@ -499,2 +452,3 @@

}
return val;

@@ -505,2 +459,3 @@ }

/*** format specific methods start ***/
/**

@@ -513,8 +468,8 @@ * Format when # based string is provided

}, {
key: 'formatWithPattern',
key: "formatWithPattern",
value: function formatWithPattern(numStr) {
var format = this.props.format;
var hashCount = 0;
var formattedNumberAry = format.split('');
for (var i = 0, ln = format.length; i < ln; i++) {

@@ -526,2 +481,3 @@ if (format[i] === '#') {

}
return formattedNumberAry.join('');

@@ -535,14 +491,14 @@ }

}, {
key: 'formatAsNumber',
key: "formatAsNumber",
value: function formatAsNumber(numStr) {
var _props5 = this.props,
decimalScale = _props5.decimalScale,
fixedDecimalScale = _props5.fixedDecimalScale,
prefix = _props5.prefix,
suffix = _props5.suffix,
allowNegative = _props5.allowNegative;
var _this$props5 = this.props,
decimalScale = _this$props5.decimalScale,
fixedDecimalScale = _this$props5.fixedDecimalScale,
prefix = _this$props5.prefix,
suffix = _this$props5.suffix,
allowNegative = _this$props5.allowNegative;
var _getSeparators4 = this.getSeparators(),
thousandSeparator = _getSeparators4.thousandSeparator,
decimalSeparator = _getSeparators4.decimalSeparator;
var _this$getSeparators4 = this.getSeparators(),
thousandSeparator = _this$getSeparators4.thousandSeparator,
decimalSeparator = _this$getSeparators4.decimalSeparator;

@@ -555,3 +511,2 @@ var hasDecimalSeparator = numStr.indexOf('.') !== -1 || decimalScale && fixedDecimalScale;

addNegation = _splitDecimal.addNegation; // eslint-disable-line prefer-const
//apply decimal precision if its defined

@@ -564,23 +519,19 @@

beforeDecimal = beforeDecimal.replace(/(\d)(?=(\d{3})+(?!\d))/g, '$1' + thousandSeparator);
}
} //add prefix and suffix
//add prefix and suffix
if (prefix) beforeDecimal = prefix + beforeDecimal;
if (suffix) afterDecimal = afterDecimal + suffix;
if (suffix) afterDecimal = afterDecimal + suffix; //restore negation sign
//restore negation sign
if (addNegation) beforeDecimal = '-' + beforeDecimal;
numStr = beforeDecimal + (hasDecimalSeparator && decimalSeparator || '') + afterDecimal;
return numStr;
}
}, {
key: 'formatNumString',
key: "formatNumString",
value: function formatNumString() {
var value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
var _props6 = this.props,
format = _props6.format,
allowEmptyFormatting = _props6.allowEmptyFormatting;
var _this$props6 = this.props,
format = _this$props6.format,
allowEmptyFormatting = _this$props6.allowEmptyFormatting;
var formattedValue = value;

@@ -604,14 +555,12 @@

}, {
key: 'formatValueProp',
key: "formatValueProp",
value: function formatValueProp() {
var _props7 = this.props,
format = _props7.format,
decimalScale = _props7.decimalScale,
fixedDecimalScale = _props7.fixedDecimalScale,
allowEmptyFormatting = _props7.allowEmptyFormatting;
var _props8 = this.props,
value = _props8.value,
isNumericString = _props8.isNumericString;
var _this$props7 = this.props,
format = _this$props7.format,
decimalScale = _this$props7.decimalScale,
fixedDecimalScale = _this$props7.fixedDecimalScale,
allowEmptyFormatting = _this$props7.allowEmptyFormatting;
var _this$props8 = this.props,
value = _this$props8.value,
isNumericString = _this$props8.isNumericString;
var isNonNumericFalsy = !value && value !== 0;

@@ -621,5 +570,5 @@

value = '';
}
} // if value is not defined return empty string
// if value is not defined return empty string
if (isNonNumericFalsy && !allowEmptyFormatting) return '';

@@ -630,6 +579,6 @@

isNumericString = true;
}
} //round the number based on decimalScale
//format only if non formatted value is provided
//round the number based on decimalScale
//format only if non formatted value is provided
if (isNumericString && !format && typeof decimalScale === 'number') {

@@ -640,21 +589,16 @@ value = (0, _utils.roundToPrecision)(value, decimalScale, fixedDecimalScale);

var formattedValue = isNumericString ? this.formatNumString(value) : this.formatInput(value);
return formattedValue;
}
}, {
key: 'formatNegation',
key: "formatNegation",
value: function formatNegation() {
var value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
var allowNegative = this.props.allowNegative;
var negationRegex = new RegExp('(-)');
var doubleNegationRegex = new RegExp('(-)(.)*(-)');
var doubleNegationRegex = new RegExp('(-)(.)*(-)'); // Check number has '-' value
// Check number has '-' value
var hasNegation = negationRegex.test(value);
var hasNegation = negationRegex.test(value); // Check number has 2 or more '-' values
// Check number has 2 or more '-' values
var removeNegation = doubleNegationRegex.test(value);
var removeNegation = doubleNegationRegex.test(value); //remove negation
//remove negation
value = value.replace(/-/g, '');

@@ -669,40 +613,33 @@

}, {
key: 'formatInput',
key: "formatInput",
value: function formatInput() {
var value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
var format = this.props.format;
var format = this.props.format; //format negation only if we are formatting as number
//format negation only if we are formatting as number
if (!format) {
value = this.formatNegation(value);
}
} //remove formatting from number
//remove formatting from number
value = this.removeFormatting(value);
return this.formatNumString(value);
}
/*** format specific methods end ***/
}, {
key: 'isCharacterAFormat',
key: "isCharacterAFormat",
value: function isCharacterAFormat(caretPos, value) {
var _props9 = this.props,
format = _props9.format,
prefix = _props9.prefix,
suffix = _props9.suffix,
decimalScale = _props9.decimalScale,
fixedDecimalScale = _props9.fixedDecimalScale;
var _this$props9 = this.props,
format = _this$props9.format,
prefix = _this$props9.prefix,
suffix = _this$props9.suffix,
decimalScale = _this$props9.decimalScale,
fixedDecimalScale = _this$props9.fixedDecimalScale;
var _getSeparators5 = this.getSeparators(),
decimalSeparator = _getSeparators5.decimalSeparator;
var _this$getSeparators5 = this.getSeparators(),
decimalSeparator = _this$getSeparators5.decimalSeparator; //check within format pattern
//check within format pattern
if (typeof format === 'string' && format[caretPos] !== '#') return true; //check in number format
if (typeof format === 'string' && format[caretPos] !== '#') return true;
//check in number format
if (!format && (caretPos < prefix.length || caretPos >= value.length - suffix.length || decimalScale && fixedDecimalScale && value[caretPos] === decimalSeparator)) {

@@ -715,3 +652,3 @@ return true;

}, {
key: 'checkIfFormatGotDeleted',
key: "checkIfFormatGotDeleted",
value: function checkIfFormatGotDeleted(start, end, value) {

@@ -721,5 +658,5 @@ for (var i = start; i < end; i++) {

}
return false;
}
/**

@@ -731,13 +668,12 @@ * This will check if any formatting got removed by the delete or backspace and reset the value

}, {
key: 'correctInputValue',
key: "correctInputValue",
value: function correctInputValue(caretPos, lastValue, value) {
var _props10 = this.props,
format = _props10.format,
decimalSeparator = _props10.decimalSeparator,
allowNegative = _props10.allowNegative;
var _this$props10 = this.props,
format = _this$props10.format,
decimalSeparator = _this$props10.decimalSeparator,
allowNegative = _this$props10.allowNegative;
var lastNumStr = this.state.numAsString || '';
var _selectionBeforeInput = this.selectionBeforeInput,
selectionStart = _selectionBeforeInput.selectionStart,
selectionEnd = _selectionBeforeInput.selectionEnd;
var _this$selectionBefore = this.selectionBeforeInput,
selectionStart = _this$selectionBefore.selectionStart,
selectionEnd = _this$selectionBefore.selectionEnd;

@@ -747,3 +683,2 @@ var _findChangedIndex = (0, _utils.findChangedIndex)(lastValue, value),

end = _findChangedIndex.end;
/* don't do anyhting if something got added,

@@ -757,11 +692,11 @@ or if value is empty string (when whole input is cleared)

return value;
}
} //if format got deleted reset the value to last value
//if format got deleted reset the value to last value
if (this.checkIfFormatGotDeleted(start, end, lastValue)) {
value = lastValue;
}
} //for numbers check if beforeDecimal got deleted and there is nothing after decimal,
//clear all numbers in such case while keeping the - sign
//for numbers check if beforeDecimal got deleted and there is nothing after decimal,
//clear all numbers in such case while keeping the - sign
if (!format) {

@@ -774,3 +709,2 @@ var numericString = this.removeFormatting(value);

addNegation = _splitDecimal2.addNegation; // eslint-disable-line prefer-const
//clear only if something got deleted

@@ -780,2 +714,3 @@

var isBeforeDecimalPoint = caretPos < value.indexOf(decimalSeparator) + 1;
if (numericString.length < lastNumStr.length && isBeforeDecimalPoint && beforeDecimal === '' && !parseFloat(afterDecimal)) {

@@ -789,3 +724,3 @@ return addNegation ? '-' : '';

}, {
key: 'onChange',
key: "onChange",
value: function onChange(e) {

@@ -798,13 +733,9 @@ e.persist();

var isAllowed = props.isAllowed;
var lastValue = state.value || '';
/*Max of selectionStart and selectionEnd is taken for the patch of pixel and other mobile device caret bug*/
/*Max of selectionStart and selectionEnd is taken for the patch of pixel and other mobile device caret bug*/
var currentCaretPosition = Math.max(el.selectionStart, el.selectionEnd);
inputValue = this.correctInputValue(currentCaretPosition, lastValue, inputValue);
var formattedValue = this.formatInput(inputValue) || '';
var numAsString = this.removeFormatting(formattedValue);
var valueObj = this.getValueObject(formattedValue, numAsString);

@@ -814,16 +745,16 @@

formattedValue = lastValue;
}
} //set the value imperatively, this is required for IE fix
//set the value imperatively, this is required for IE fix
el.value = formattedValue;
//get the caret position
var caretPos = this.getCaretPosition(inputValue, formattedValue, currentCaretPosition);
el.value = formattedValue; //get the caret position
//set caret position
this.setPatchedCaretPosition(el, caretPos, formattedValue);
var caretPos = this.getCaretPosition(inputValue, formattedValue, currentCaretPosition); //set caret position
//change the state
this.setPatchedCaretPosition(el, caretPos, formattedValue); //change the state
if (formattedValue !== lastValue) {
this.setState({ value: formattedValue, numAsString: numAsString }, function () {
this.setState({
value: formattedValue,
numAsString: numAsString
}, function () {
props.onValueChange(valueObj, e);

@@ -837,3 +768,3 @@ props.onChange(e);

}, {
key: 'onBlur',
key: "onBlur",
value: function onBlur(e) {

@@ -847,14 +778,17 @@ var _this2 = this;

var numAsString = state.numAsString;
var lastValue = state.value;
var lastValue = state.value;
if (!format) {
numAsString = (0, _utils.fixLeadingZero)(numAsString);
var formattedValue = this.formatNumString(numAsString);
var formattedValue = this.formatNumString(numAsString); //change the state
//change the state
if (formattedValue !== lastValue) {
// the event needs to be persisted because its properties can be accessed in an asynchronous way
e.persist();
this.setState({ value: formattedValue, numAsString: numAsString }, function () {
this.setState({
value: formattedValue,
numAsString: numAsString
}, function () {
var valueObj = _this2.getValueObject(formattedValue, numAsString);
props.onValueChange(valueObj, e);

@@ -866,6 +800,7 @@ onBlur(e);

}
onBlur(e);
}
}, {
key: 'onKeyDown',
key: "onKeyDown",
value: function onKeyDown(e) {

@@ -879,14 +814,12 @@ var _this3 = this;

_el$value = el.value,
value = _el$value === undefined ? '' : _el$value;
var expectedCaretPosition = void 0;
var _props11 = this.props,
decimalScale = _props11.decimalScale,
fixedDecimalScale = _props11.fixedDecimalScale,
prefix = _props11.prefix,
suffix = _props11.suffix,
format = _props11.format,
onKeyDown = _props11.onKeyDown,
onValueChange = _props11.onValueChange;
value = _el$value === void 0 ? '' : _el$value;
var expectedCaretPosition;
var _this$props11 = this.props,
decimalScale = _this$props11.decimalScale,
fixedDecimalScale = _this$props11.fixedDecimalScale,
prefix = _this$props11.prefix,
suffix = _this$props11.suffix,
format = _this$props11.format,
onKeyDown = _this$props11.onKeyDown,
onValueChange = _this$props11.onValueChange;
var ignoreDecimalSeparator = decimalScale !== undefined && fixedDecimalScale;

@@ -896,9 +829,9 @@ var numRegex = this.getNumberRegex(false, ignoreDecimalSeparator);

var isPatternFormat = typeof format === 'string';
this.selectionBeforeInput = {
selectionStart: selectionStart,
selectionEnd: selectionEnd
selectionEnd: selectionEnd //Handle backspace and delete against non numerical/decimal characters or arrow keys
//Handle backspace and delete against non numerical/decimal characters or arrow keys
};if (key === 'ArrowLeft' || key === 'Backspace') {
};
if (key === 'ArrowLeft' || key === 'Backspace') {
expectedCaretPosition = selectionStart - 1;

@@ -909,6 +842,6 @@ } else if (key === 'ArrowRight') {

expectedCaretPosition = selectionStart;
}
} //if expectedCaretPosition is not set it means we don't want to Handle keyDown
//also if multiple characters are selected don't handle
//if expectedCaretPosition is not set it means we don't want to Handle keyDown
//also if multiple characters are selected don't handle
if (expectedCaretPosition === undefined || selectionStart !== selectionEnd) {

@@ -931,3 +864,3 @@ onKeyDown(e);

} else if (key === 'Backspace' && !numRegex.test(value[expectedCaretPosition])) {
/* NOTE: This is special case when backspace is pressed on a
/* NOTE: This is special case when backspace is pressed on a
negative value while the cursor position is after prefix. We can't handle it on onChange because

@@ -938,9 +871,12 @@ we will not have any information of keyPress

var newValue = value.substring(1);
var _numAsString2 = this.removeFormatting(newValue);
var valueObj = this.getValueObject(newValue, _numAsString2);
var numAsString = this.removeFormatting(newValue);
var valueObj = this.getValueObject(newValue, numAsString); //persist event before performing async task
//persist event before performing async task
e.persist();
this.setState({ value: newValue, numAsString: _numAsString2 }, function () {
this.setState({
value: newValue,
numAsString: numAsString
}, function () {
_this3.setPatchedCaretPosition(el, newCaretPosition, newValue);
onValueChange(valueObj, e);

@@ -952,2 +888,3 @@ });

}
newCaretPosition = this.correctCaretPosition(value, newCaretPosition, 'left');

@@ -961,5 +898,6 @@ }

}
/* NOTE: this is just required for unit test as we need to get the newCaretPosition,
Remove this when you find different solution */
if (e.isUnitTestRun) {

@@ -971,22 +909,21 @@ this.setPatchedCaretPosition(el, newCaretPosition, value);

}
/** required to handle the caret position when click anywhere within the input **/
}, {
key: 'onMouseUp',
key: "onMouseUp",
value: function onMouseUp(e) {
var el = e.target;
/**
* NOTE: we have to give default value for value as in case when custom input is provided
/**
* NOTE: we have to give default value for value as in case when custom input is provided
* value can come as undefined when nothing is provided on value prop.
*/
var selectionStart = el.selectionStart,
selectionEnd = el.selectionEnd,
_el$value2 = el.value,
value = _el$value2 === undefined ? '' : _el$value2;
value = _el$value2 === void 0 ? '' : _el$value2;
if (selectionStart === selectionEnd) {
var caretPosition = this.correctCaretPosition(value, selectionStart);
if (caretPosition !== selectionStart) {

@@ -1000,3 +937,3 @@ this.setPatchedCaretPosition(el, caretPosition, value);

}, {
key: 'onFocus',
key: "onFocus",
value: function onFocus(e) {

@@ -1011,8 +948,9 @@ var _this4 = this;

var selectionStart = el.selectionStart,
selectionEnd = el.selectionEnd,
_el$value3 = el.value,
value = _el$value3 === undefined ? '' : _el$value3;
value = _el$value3 === void 0 ? '' : _el$value3;
var caretPosition = _this4.correctCaretPosition(value, selectionStart);
var caretPosition = _this4.correctCaretPosition(value, selectionStart);
if (caretPosition !== selectionStart) {
if (caretPosition !== selectionStart && !(selectionStart === 0 && selectionEnd === value.length)) {
_this4.setPatchedCaretPosition(el, caretPosition, value);

@@ -1025,16 +963,13 @@ }

}, {
key: 'render',
key: "render",
value: function render() {
var _props12 = this.props,
type = _props12.type,
displayType = _props12.displayType,
customInput = _props12.customInput,
renderText = _props12.renderText,
getInputRef = _props12.getInputRef;
var _this$props12 = this.props,
type = _this$props12.type,
displayType = _this$props12.displayType,
customInput = _this$props12.customInput,
renderText = _this$props12.renderText,
getInputRef = _this$props12.getInputRef;
var value = this.state.value;
var otherProps = (0, _utils.omit)(this.props, propTypes);
var inputProps = (0, _extends3.default)({}, otherProps, {
var inputProps = Object.assign({}, otherProps, {
type: type,

@@ -1050,13 +985,11 @@ value: value,

if (displayType === 'text') {
return renderText ? renderText(value) || null : _react2.default.createElement(
'span',
(0, _extends3.default)({}, otherProps, { ref: getInputRef }),
value
);
return renderText ? renderText(value) || null : _react.default.createElement("span", _extends({}, otherProps, {
ref: getInputRef
}), value);
} else if (customInput) {
var CustomInput = customInput;
return _react2.default.createElement(CustomInput, inputProps);
return _react.default.createElement(CustomInput, inputProps);
}
return _react2.default.createElement('input', (0, _extends3.default)({}, inputProps, {
return _react.default.createElement("input", _extends({}, inputProps, {
ref: getInputRef

@@ -1066,9 +999,10 @@ }));

}]);
return NumberFormat;
}(_react2.default.Component);
}(_react.default.Component);
NumberFormat.propTypes = propTypes;
NumberFormat.defaultProps = defaultProps;
exports.default = NumberFormat;
module.exports = exports['default'];
var _default = NumberFormat;
exports.default = _default;
module.exports = exports.default;

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

'use strict';
"use strict";

@@ -6,7 +6,2 @@ Object.defineProperty(exports, "__esModule", {

});
var _keys = require('babel-runtime/core-js/object/keys');
var _keys2 = _interopRequireDefault(_keys);
exports.noop = noop;

@@ -25,6 +20,5 @@ exports.returnTrue = returnTrue;

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
// basic noop function
function noop() {}
function returnTrue() {

@@ -39,17 +33,14 @@ return true;

function escapeRegExp(str) {
return str.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&");
}
return str.replace(/[-[\]/{}()*+?.\\^$|]/g, "\\$&");
} //spilt a float number into different parts beforeDecimal, afterDecimal, and negation
//spilt a float number into different parts beforeDecimal, afterDecimal, and negation
function splitDecimal(numStr) {
var allowNegative = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
var hasNagation = numStr[0] === '-';
var addNegation = hasNagation && allowNegative;
numStr = numStr.replace('-', '');
var parts = numStr.split('.');
var beforeDecimal = parts[0];
var afterDecimal = parts[1] || '';
return {

@@ -70,6 +61,4 @@ beforeDecimal: beforeDecimal,

var afterDecimal = parts[1] || '';
return '' + (isNegative ? '-' : '') + beforeDecimal + (afterDecimal ? '.' + afterDecimal : '');
return "".concat(isNegative ? '-' : '').concat(beforeDecimal).concat(afterDecimal ? ".".concat(afterDecimal) : '');
}
/**

@@ -79,11 +68,14 @@ * limit decimal numbers to given scale

*/
function limitToScale(numStr, scale, fixedDecimalScale) {
var str = '';
var filler = fixedDecimalScale ? '0' : '';
for (var i = 0; i <= scale - 1; i++) {
str += numStr[i] || filler;
}
return str;
}
/**

@@ -93,6 +85,7 @@ * This method is required to round prop value to given scale.

*/
function roundToPrecision(numStr, scale, fixedDecimalScale) {
//if number is empty don't do anything return empty string
if (['', '-'].indexOf(numStr) !== -1) return numStr;
var shoudHaveDecimalSeparator = numStr.indexOf('.') !== -1 && scale;

@@ -105,3 +98,3 @@

var roundedDecimalParts = parseFloat('0.' + (afterDecimal || '0')).toFixed(scale).split('.');
var roundedDecimalParts = parseFloat("0.".concat(afterDecimal || '0')).toFixed(scale).split('.');
var intPart = beforeDecimal.split('').reverse().reduce(function (roundedStr, current, idx) {

@@ -111,9 +104,9 @@ if (roundedStr.length > idx) {

}
return current + roundedStr;
}, roundedDecimalParts[0]);
var decimalPart = limitToScale(roundedDecimalParts[1] || '', Math.min(scale, afterDecimal.length), fixedDecimalScale);
var negation = hasNagation ? '-' : '';
var decimalSeparator = shoudHaveDecimalSeparator ? '.' : '';
return '' + negation + intPart + decimalSeparator + decimalPart;
return "".concat(negation).concat(intPart).concat(decimalSeparator).concat(decimalPart);
}

@@ -123,3 +116,3 @@

var filteredObj = {};
(0, _keys2.default)(obj).forEach(function (key) {
Object.keys(obj).forEach(function (key) {
if (!keyMaps[key]) filteredObj[key] = obj[key];

@@ -129,9 +122,10 @@ });

}
/** set the caret positon in an input field **/
/** set the caret positon in an input field **/
function setCaretPosition(el, caretPos) {
el.value = el.value;
// ^ this is used to not only get "focus", but
el.value = el.value; // ^ this is used to not only get "focus", but
// to make sure we don't have it everything -selected-
// (it causes an issue in chrome, and having it doesn't hurt any other browser)
if (el !== null) {

@@ -143,4 +137,5 @@ if (el.createTextRange) {

return true;
}
// (el.selectionStart === 0 added for Firefox bug)
} // (el.selectionStart === 0 added for Firefox bug)
if (el.selectionStart || el.selectionStart === 0) {

@@ -150,5 +145,5 @@ el.focus();

return true;
}
} // fail city, fortunately this never happens (as far as I've tested) :)
// fail city, fortunately this never happens (as far as I've tested) :)
el.focus();

@@ -158,3 +153,2 @@ return false;

}
/**

@@ -166,2 +160,4 @@ Given previous value and newValue it returns the index

*/
function findChangedIndex(prevValue, newValue) {

@@ -172,5 +168,8 @@ var i = 0,

var newLength = newValue.length;
while (prevValue[i] === newValue[i] && i < prevLength) {
i++;
} //check what has been changed from last
while (prevValue[prevLength - 1 - j] === newValue[newLength - 1 - j] && newLength - j > i && prevLength - j > i) {

@@ -180,10 +179,14 @@ j++;

return { start: i, end: prevLength - j };
return {
start: i,
end: prevLength - j
};
}
/*
Returns a number whose value is limited to the given range
*/
function clamp(num, min, max) {
return Math.min(Math.max(num, min), max);
}
{
"name": "react-number-format",
"description": "React component to format number in an input or as a text.",
"version": "3.5.2",
"version": "3.6.0",
"main": "lib/number_format.js",

@@ -27,38 +27,34 @@ "author": "Sudhanshu Yadav",

"scripts": {
"start": "webpack-dev-server --content-base example/ --config webpack.dev.config.js --watch-poll --progress --inline --hot",
"bundle": "cross-env NODE_ENV=production npm run compile && cross-env NODE_ENV=production webpack --config webpack.bundle.config.js && cross-env NODE_ENV=production TEST_BROWSER=ChromeHeadless karma start",
"start": "webpack-dev-server --hot",
"bundle": "cross-env yarn compile && yarn bundle-dist && yarn test-build",
"bundle-dist": "cross-env NODE_ENV=production rollup -c rollup.config.js",
"compile": "cross-env NODE_ENV=production babel src --out-dir lib",
"test": "cross-env NODE_ENV=test karma start",
"test-build": "cross-env NODE_ENV=production TEST_BROWSER=ChromeHeadless karma start",
"lint": "cross-env eslint src/**"
},
"devDependencies": {
"babel-cli": "^6.7.5",
"babel-core": "^6.7.2",
"babel-eslint": "^6.0.0",
"babel-loader": "^6.2.4",
"babel-plugin-add-module-exports": "^0.2.1",
"babel-plugin-react-transform": "^2.0.2",
"babel-plugin-transform-flow-strip-types": "^6.22.0",
"babel-plugin-transform-object-assign": "^6.8.0",
"babel-plugin-transform-runtime": "^6.23.0",
"babel-preset-es2015": "^6.6.0",
"babel-preset-react": "^6.11.1",
"babel-register": "^6.7.2",
"@babel/cli": "^7.0.0",
"@babel/core": "^7.0.1",
"@babel/plugin-proposal-class-properties": "^7.0.0",
"@babel/plugin-proposal-object-rest-spread": "^7.0.0",
"@babel/plugin-transform-flow-strip-types": "^7.0.0",
"@babel/preset-env": "^7.0.0",
"@babel/preset-react": "^7.0.0",
"@babel/register": "^7.0.0",
"babel-eslint": "^9.0.0",
"babel-loader": "^8.0.2",
"babel-plugin-add-module-exports": "^1.0.0",
"classnames": "^2.2.3",
"cross-env": "^3.1.4",
"enzyme": "^3.0.0",
"enzyme-adapter-react-16": "^1.0.0",
"eslint": "^2.5.3",
"eslint-config-standard": "^5.1.0",
"eslint-loader": "^1.3.0",
"eslint-plugin-import": "^1.4.0",
"eslint-plugin-jsx-a11y": "^0.6.2",
"eslint-plugin-promise": "^1.1.0",
"eslint-plugin-react": "^4.3.0",
"eslint-plugin-standard": "^1.3.2",
"flow-bin": "^0.54.1",
"enzyme": "^3.6.0",
"enzyme-adapter-react-16": "^1.5.0",
"eslint": "^5.6.0",
"eslint-loader": "^2.1.0",
"eslint-plugin-import": "^2.14.0",
"eslint-plugin-react": "^7.11.1",
"flow-bin": "0.54.1",
"jasmine": "^2.4.1",
"jasmine-core": "^2.4.1",
"json-loader": "^0.5.4",
"karma": "^1.7.1",
"karma": "^3.0.0",
"karma-chrome-launcher": "^2.2.0",

@@ -68,12 +64,23 @@ "karma-cli": "^1.0.1",

"karma-jasmine-html-reporter": "^0.2.0",
"karma-rollup-preprocessor": "^6.0.1",
"karma-sourcemap-loader": "^0.3.7",
"karma-spec-reporter": "^0.0.31",
"karma-webpack": "^1.7.0",
"karma-spec-reporter": "^0.0.32",
"karma-webpack": "^3.0.5",
"material-ui": "^0.19.2",
"react": "^16.0.0",
"react-dom": "^16.0.0",
"react-test-renderer": "^16.0.0",
"nodemon": "^1.12.1",
"react": "^15.4.0 || ^16.0.0",
"react-dom": "^15.4.0 || ^16.0.0",
"react-router": "3",
"react-transform-hmr": "^1.0.4",
"webpack": "^1.12.14",
"webpack-dev-server": "^1.14.1"
"rollup": "^0.65.2",
"rollup-plugin-babel": "^4.0.3",
"rollup-plugin-commonjs": "^9.1.6",
"rollup-plugin-filesize": "^4.0.1",
"rollup-plugin-license": "^0.7.0",
"rollup-plugin-node-resolve": "^3.4.0",
"rollup-plugin-replace": "^2.0.0",
"rollup-plugin-uglify": "^5.0.2",
"webpack": "^4.17.1",
"webpack-cli": "^3.1.0",
"webpack-dev-server": "^3.1.7"
},

@@ -86,5 +93,4 @@ "peerDependencies": {

"dependencies": {
"babel-runtime": "^6.26.0",
"prop-types": "^15.6.0"
}
}

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

renderText?: (formattedValue: string) => React.ReactNode;
getInputRef?: (el: HTMLInputElement) => void;
getInputRef?: ((el: HTMLInputElement) => void) | React.Ref<any>;
}

@@ -58,0 +58,0 @@

Sorry, the diff of this file is too big to 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