react-currency-input-field
Advanced tools
Comparing version 0.5.0 to 0.5.1
@@ -0,1 +1,8 @@ | ||
## [0.5.1](https://github.com/cchanxzy/react-currency-input-field/compare/v0.5.0...v0.5.1) (2019-11-30) | ||
### Bug Fixes | ||
* modify typescript config to correctly output types ([#19](https://github.com/cchanxzy/react-currency-input-field/issues/19)) ([392082e](https://github.com/cchanxzy/react-currency-input-field/commit/392082e7f59e202c97345d7e8d2a552adebced16)) | ||
# [0.5.0](https://github.com/cchanxzy/react-currency-input-field/compare/v0.4.1...v0.5.0) (2019-11-30) | ||
@@ -2,0 +9,0 @@ |
@@ -1,19 +0,4 @@ | ||
import React, { PureComponent } from 'react'; | ||
interface IProps { | ||
id: string; | ||
className?: string; | ||
limit?: number; | ||
prefix?: string; | ||
handleError?: () => void; | ||
onChange: (value: number) => void; | ||
placeholder?: string; | ||
} | ||
interface IState { | ||
value: string; | ||
} | ||
export declare class CurrencyInput extends PureComponent<IProps, IState> { | ||
private constructor(); | ||
processChange(event: React.ChangeEvent<HTMLInputElement>): boolean; | ||
render(): JSX.Element; | ||
} | ||
import { FC } from 'react'; | ||
import { CurrencyInputProps } from './CurrencyInputProps'; | ||
export declare const CurrencyInput: FC<CurrencyInputProps>; | ||
export default CurrencyInput; |
@@ -1,3 +0,11 @@ | ||
export declare const addCommas: (value: number) => string; | ||
export declare const addCommas: (value: string) => string; | ||
export declare const removeCommas: (value: string) => string; | ||
export declare const checkIsValidNumber: (input: number, limit: number) => boolean; | ||
export declare const checkIsValidNumber: (input: string) => boolean; | ||
/** | ||
* Remove prefix, commas and extra decimals from value | ||
*/ | ||
export declare const cleanValue: (value: string, allowDecimals: boolean, decimalsLimit: number, prefix?: string | undefined) => string; | ||
/** | ||
* Format value with commas and prefix | ||
*/ | ||
export declare const formatValue: (value: string, prefix?: string | undefined) => string; |
@@ -1,2 +0,2 @@ | ||
module.exports=function(e){var r={};function t(n){if(r[n])return r[n].exports;var u=r[n]={i:n,l:!1,exports:{}};return e[n].call(u.exports,u,u.exports,t),u.l=!0,u.exports}return t.m=e,t.c=r,t.d=function(e,r,n){t.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:n})},t.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},t.t=function(e,r){if(1&r&&(e=t(e)),8&r)return e;if(4&r&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(t.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&r&&"string"!=typeof e)for(var u in e)t.d(n,u,function(r){return e[r]}.bind(null,u));return n},t.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(r,"a",r),r},t.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},t.p="",t(t.s=1)}([function(e,r){e.exports=require("react")},function(e,r,t){"use strict";t.r(r);var n=t(0),u=t.n(n),o=function(e,r){var t=e.split("."),n=t[0],u=t[1],o=r||"",i=e.includes(".")?"."+u:"";return""+o+function(e){return e.replace(/\B(?=(\d{3})+(?!\d))/g,",")}(n)+i},i=function(e){var r=e.allowDecimals,t=void 0===r||r,i=e.id,a=e.name,l=e.className,c=e.decimalsLimit,f=void 0===c?2:c,d=e.defaultValue,s=e.onChange,p=e.placeholder,m=e.prefix,v=Object(n.useState)(d?o(String(d),m):""),b=v[0],g=v[1];return u.a.createElement("input",{type:"string",id:i,name:a,className:l,onChange:function(e){var r,n=function(e,r,t,n){var u=function(e){return e.replace(/,/g,"")}(n?e.replace(n,""):e);if(u.includes(".")){var o=u.split("."),i=o[0],a=o[1];return""+i+(r?"."+(t?a.slice(0,t):a):"")}return u}(e.target.value,t,f,m);if(!n)return s(null,a),g("");r=n,Number(r)<0||isNaN(Number(r))||g(o(n,m)),s(Number(n),a)},onFocus:function(){return b?b.length:0},placeholder:p,value:b,pattern:"[0-9]*"})};r.default=i}]); | ||
module.exports=function(e){var r={};function t(n){if(r[n])return r[n].exports;var u=r[n]={i:n,l:!1,exports:{}};return e[n].call(u.exports,u,u.exports,t),u.l=!0,u.exports}return t.m=e,t.c=r,t.d=function(e,r,n){t.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:n})},t.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},t.t=function(e,r){if(1&r&&(e=t(e)),8&r)return e;if(4&r&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(t.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&r&&"string"!=typeof e)for(var u in e)t.d(n,u,function(r){return e[r]}.bind(null,u));return n},t.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(r,"a",r),r},t.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},t.p="",t(t.s=0)}([function(e,r,t){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(r,"__esModule",{value:!0});var u=n(t(1));r.default=u.default},function(e,r,t){"use strict";var n=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var r={};if(null!=e)for(var t in e)Object.hasOwnProperty.call(e,t)&&(r[t]=e[t]);return r.default=e,r};Object.defineProperty(r,"__esModule",{value:!0});var u=n(t(2)),a=t(3);r.CurrencyInput=function(e){var r=e.allowDecimals,t=void 0===r||r,n=e.id,o=e.name,l=e.className,i=e.decimalsLimit,c=void 0===i?2:i,f=e.defaultValue,s=e.onChange,d=e.placeholder,p=e.prefix,m=u.useState(f?a.formatValue(String(f),p):""),v=m[0],b=m[1];return u.default.createElement("input",{type:"string",id:n,name:o,className:l,onChange:function(e){var r=e.target.value,n=a.cleanValue(r,t,c,p);if(!n)return s(null,o),b("");a.checkIsValidNumber(n)&&b(a.formatValue(n,p)),s(Number(n),o)},onFocus:function(){return v?v.length:0},placeholder:d,value:v,pattern:"[0-9]*"})},r.default=r.CurrencyInput},function(e,r){e.exports=require("react")},function(e,r,t){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.addCommas=function(e){return e.replace(/\B(?=(\d{3})+(?!\d))/g,",")},r.removeCommas=function(e){return e.replace(/,/g,"")},r.checkIsValidNumber=function(e){return!(Number(e)<0||isNaN(Number(e)))},r.cleanValue=function(e,t,n,u){var a=u?e.replace(u,""):e,o=r.removeCommas(a);if(o.includes(".")){var l=o.split("."),i=l[0],c=l[1];return""+i+(t?"."+(n?c.slice(0,n):c):"")}return o},r.formatValue=function(e,t){var n=e.split("."),u=n[0],a=n[1],o=t||"",l=e.includes(".")?"."+a:"";return""+o+r.addCommas(u)+l}}]); | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "react-currency-input-field", | ||
"version": "0.5.0", | ||
"version": "0.5.1", | ||
"description": "React input field component for currency and numbers", | ||
@@ -9,9 +9,10 @@ "files": [ | ||
"main": "dist/index.js", | ||
"types": "dist/index", | ||
"homepage": "https://cchanxzy.github.io/react-currency-input-field", | ||
"scripts": { | ||
"build": "NODE_ENV='prod' webpack --mode=production", | ||
"build": "rm -rf dist && tsc && NODE_ENV='prod' webpack --mode=production", | ||
"start": "NODE_ENV='dev' webpack-dev-server --mode=development --hot", | ||
"test": "jest --coverage", | ||
"test:watch": "jest --coverage --watch", | ||
"lint": "tsc --noEmit && eslint 'src/**/*.{js,ts,tsx}' --max-warnings=0", | ||
"lint": "tsc && eslint 'src/**/*.{js,ts,tsx}' --max-warnings=0", | ||
"gh-predeploy": "NODE_ENV='dev' webpack --mode=development", | ||
@@ -73,3 +74,3 @@ "gh-deploy": "gh-pages -d dist", | ||
"ts-jest": "^24.0.2", | ||
"typescript": "^3.0.3", | ||
"typescript": "^3.7.2", | ||
"webpack": "^4.19.1", | ||
@@ -76,0 +77,0 @@ "webpack-cli": "^3.1.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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
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
21642
9
68
1