@rschpdr/react-money-input
Advanced tools
Comparing version 0.1.0 to 0.1.1
@@ -1,2 +0,2 @@ | ||
!function(e,r){if("object"===typeof exports&&"object"===typeof module)module.exports=r(require("react"),require("currency.js"));else if("function"===typeof define&&define.amd)define(["react","currency.js"],r);else{var t="object"===typeof exports?r(require("react"),require("currency.js")):r(e.react,e["currency.js"]);for(var n in t)("object"===typeof exports?exports:e)[n]=t[n]}}(this,(function(e,r){return function(e){var r={};function t(n){if(r[n])return r[n].exports;var o=r[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,t),o.l=!0,o.exports}return t.m=e,t.c=r,t.d=function(e,r,n){t.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:n})},t.r=function(e){"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},t.t=function(e,r){if(1&r&&(e=t(e)),8&r)return e;if(4&r&&"object"===typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(t.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&r&&"string"!=typeof e)for(var o in e)t.d(n,o,function(r){return e[r]}.bind(null,o));return n},t.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(r,"a",r),r},t.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},t.p="/",t(t.s=2)}([function(r,t){r.exports=e},function(e,t){e.exports=r},function(e,r,t){e.exports=t(3)},function(e,r,t){"use strict";function n(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function o(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,n)}return t}t.r(r);var u=t(0),c=t.n(u),i=t(1),a=t.n(i),l=/^[1-9]{1}$/,s=/^[0-9]{1}$/,f=function(e){var r=e.className,t=void 0===r?"":r,i=e.style,f=void 0===i?{}:i,p=e.currencyConfig,y=void 0===p?{locale:"en-US",currencyCode:"USD",currencyDisplay:"symbol",useGrouping:!0,minimumFractionDigits:void 0}:p,b=e.customInput,d=e.name,m=e.id,v=e.max,j=void 0===v?Number.MAX_SAFE_INTEGER:v,g=e.onChange,O=e.value,x={target:{type:"number",name:d,id:m}},P=a()(O).intValue,D=Math.trunc(Math.abs(P));if(P!==D||!Number.isFinite(P)||Number.isNaN(P))throw new Error("invalid value property");var S=Object(u.useCallback)((function(e){var r=e.key,t=e.keyCode;if((0!==P||l.test(r))&&(0===P||s.test(r)||8===t)){var n,o=P.toString();if(8!==t){var u=0===P?r:"".concat(o).concat(r);n=Number.parseInt(u,10)}else{var c=o.slice(0,-1);n=""===c?0:Number.parseInt(c,10)}n>j||(x.target.value=a()(n/100).value,g(x))}}),[j,g,P]),h=Object(u.useCallback)((function(){}),[]),w=y.locale,N=y.currencyCode,C=y.currencyDisplay,E=y.useGrouping,M=y.minimumFractionDigits,_={"data-testid":"currency-input",className:t,inputMode:"numeric",onChange:h,onKeyDown:S,style:f,value:a()(P/100).value.toLocaleString(w,{style:"currency",currency:N,currencyDisplay:C,useGrouping:E,minimumFractionDigits:M})};if(b){var k=function(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?o(Object(t),!0).forEach((function(r){n(e,r,t[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):o(Object(t)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}))}return e}({},e,{},_);delete k.customInput;var F=b;return c.a.createElement(F,k)}return c.a.createElement("input",_)};r.default=f}])})); | ||
!function(e,r){if("object"===typeof exports&&"object"===typeof module)module.exports=r(require("react"),require("currency.js"));else if("function"===typeof define&&define.amd)define(["react","currency.js"],r);else{var t="object"===typeof exports?r(require("react"),require("currency.js")):r(e.react,e["currency.js"]);for(var n in t)("object"===typeof exports?exports:e)[n]=t[n]}}(this,(function(e,r){return function(e){var r={};function t(n){if(r[n])return r[n].exports;var o=r[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,t),o.l=!0,o.exports}return t.m=e,t.c=r,t.d=function(e,r,n){t.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:n})},t.r=function(e){"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},t.t=function(e,r){if(1&r&&(e=t(e)),8&r)return e;if(4&r&&"object"===typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(t.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&r&&"string"!=typeof e)for(var o in e)t.d(n,o,function(r){return e[r]}.bind(null,o));return n},t.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(r,"a",r),r},t.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},t.p="/",t(t.s=2)}([function(r,t){r.exports=e},function(e,t){e.exports=r},function(e,r,t){e.exports=t(3)},function(e,r,t){"use strict";function n(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function o(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,n)}return t}t.r(r);var u=t(0),i=t.n(u),c=t(1),a=t.n(c),l=/^[1-9]{1}$/,s=/^[0-9]{1}$/,f=function(e){var r=e.className,t=void 0===r?"":r,c=e.style,f=void 0===c?{}:c,p=e.currencyConfig,y=void 0===p?{locale:"en-US",currencyCode:"USD",currencyDisplay:"symbol",useGrouping:!0,minimumFractionDigits:void 0}:p,b=e.customInput,d=e.name,m=e.id,v=e.max,g=void 0===v?Number.MAX_SAFE_INTEGER:v,j=e.onChange,O=e.value,x={target:{type:"number",name:d,id:m}},P=a()(O).intValue,D=Math.trunc(Math.abs(P));if(P!==D||!Number.isFinite(P)||Number.isNaN(P))throw new Error("invalid value property");var S=Object(u.useCallback)((function(e){var r=e.key,t=e.keyCode;if((0!==P||l.test(r))&&(0===P||s.test(r)||8===t)){var n,o=P.toString();if(8!==t){var u=0===P?r:"".concat(o).concat(r);n=Number.parseInt(u,10)}else{var i=o.slice(0,-1);n=""===i?0:Number.parseInt(i,10)}n>g||(x.target.value=a()(n/100).value,j(x))}}),[g,j,P]),h=Object(u.useCallback)((function(){}),[]),w=y.locale,N=y.currencyCode,C=y.currencyDisplay,E=y.useGrouping,M=y.minimumFractionDigits,_={"data-testid":"currency-input",className:t,inputMode:"numeric",onChange:h,onKeyDown:S,style:f,value:a()(P/100).value.toLocaleString(w,{style:"currency",currency:N,currencyDisplay:C,useGrouping:E,minimumFractionDigits:M})};if(b){var k=function(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?o(t,!0).forEach((function(r){n(e,r,t[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):o(t).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}))}return e}({},e,{},_);delete k.customInput;var F=b;return i.a.createElement(F,k)}return i.a.createElement("input",_)};r.default=f}])})); | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "@rschpdr/react-money-input", | ||
"version": "0.1.0", | ||
"version": "0.1.1", | ||
"description": "A currency text input for React that Just Works™", | ||
@@ -85,3 +85,3 @@ "author": "rschpdr", | ||
"style-loader": "1.0.0", | ||
"terser-webpack-plugin": "1.4.1", | ||
"terser-webpack-plugin": "^1.4.3", | ||
"ts-pnp": "1.1.4", | ||
@@ -97,2 +97,7 @@ "url-loader": "2.1.0", | ||
}, | ||
"resolutions": { | ||
"**/**/serialize-javascript": "^2.1.1", | ||
"**/**/acorn": "^7.1.1", | ||
"**/**/minimist": "^1.2.2" | ||
}, | ||
"eslintConfig": { | ||
@@ -99,0 +104,0 @@ "extends": "react-app" |
@@ -16,3 +16,3 @@ # React Money Input | ||
```bash | ||
npm install --save react-money-input currency.js | ||
npm install --save @rschpdr/react-money-input currency.js | ||
``` | ||
@@ -19,0 +19,0 @@ |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
32943
8