react-currency-input-field
Advanced tools
Comparing version 1.0.0 to 1.0.1
137
package.json
{ | ||
"name": "react-currency-input-field", | ||
"version": "1.0.0", | ||
"description": "React Currency Input Field", | ||
"main": "index.js", | ||
"version": "1.0.1", | ||
"description": "React <input /> component for formatting currency and numbers.", | ||
"files": [ | ||
"dist/**/*" | ||
], | ||
"main": "dist/index.js", | ||
"types": "dist/index", | ||
"homepage": "https://cchanxzy.github.io/react-currency-input-field", | ||
"scripts": { | ||
"build": "NODE_ENV='production' ./node_modules/webpack/bin/webpack.js", | ||
"start": "NODE_ENV='dev' ./node_modules/webpack-dev-server/bin/webpack-dev-server.js", | ||
"test": "./node_modules/mocha/bin/mocha --require babel-register --watch" | ||
"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 && eslint 'src/**/*.{js,ts,tsx}' --max-warnings=0", | ||
"gh-predeploy": "NODE_ENV='dev' webpack --mode=development", | ||
"gh-deploy": "yarn gh-predeploy && gh-pages -d dist", | ||
"ci": "yarn && yarn build", | ||
"codecov": "codecov", | ||
"semantic-release": "semantic-release" | ||
}, | ||
"author": "Chun", | ||
"license": "MIT", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/cchanxzy/React-Currency-Input-Field" | ||
"url": "https://github.com/cchanxzy/react-currency-input-field" | ||
}, | ||
"bugs": { | ||
"email": "cchan.xzy@gmail.com", | ||
"url": "https://github.com/cchanxzy/react-currency-input-field/issues" | ||
}, | ||
"keywords": [ | ||
"react-component", | ||
"react", | ||
"component", | ||
"currency", | ||
"input", | ||
"form", | ||
"field", | ||
"number", | ||
"number-format", | ||
"mask" | ||
"input" | ||
], | ||
"author": "cchanxzy", | ||
"license": "MIT", | ||
"devDependencies": { | ||
"babel-cli": "^6.26.0", | ||
"babel-core": "^6.26.3", | ||
"babel-loader": "^7.1.2", | ||
"babel-preset-env": "^1.7.0", | ||
"babel-preset-react": "^6.24.1", | ||
"chai": "^4.1.2", | ||
"compression-webpack-plugin": "^1.0.1", | ||
"css-loader": "^0.28.7", | ||
"enzyme": "^3.3.0", | ||
"enzyme-adapter-react-16": "^1.1.1", | ||
"eslint": "^4.8.0", | ||
"eslint-config-airbnb": "^16.0.0", | ||
"eslint-plugin-import": "^2.7.0", | ||
"eslint-plugin-jsx-a11y": "^6.0.2", | ||
"eslint-plugin-mocha": "^5.0.0", | ||
"eslint-plugin-react": "^7.4.0", | ||
"jest": "^21.2.1", | ||
"mocha": "^4.0.1", | ||
"react-test-renderer": "^16.0.0", | ||
"react-test-utils": "0.0.1", | ||
"style-loader": "^0.19.0", | ||
"webpack": "^3.6.0", | ||
"webpack-dev-server": "^2.9.1" | ||
"@commitlint/cli": "^8.3.5", | ||
"@commitlint/config-conventional": "^8.3.4", | ||
"@semantic-release/changelog": "^5.0.1", | ||
"@semantic-release/git": "^9.0.0", | ||
"@types/enzyme": "^3.10.5", | ||
"@types/jest": "^25.2.1", | ||
"@types/react": "^16.9.34", | ||
"@types/react-dom": "^16.9.6", | ||
"@typescript-eslint/eslint-plugin": "^2.29.0", | ||
"@typescript-eslint/parser": "^2.29.0", | ||
"awesome-typescript-loader": "^5.2.1", | ||
"codecov": "^3.6.5", | ||
"enzyme": "^3.11.0", | ||
"enzyme-adapter-react-16": "^1.15.2", | ||
"eslint": "^6.8.0", | ||
"eslint-config-prettier": "^6.11.0", | ||
"eslint-plugin-prettier": "^3.1.3", | ||
"eslint-plugin-react": "^7.19.0", | ||
"gh-pages": "^2.2.0", | ||
"html-webpack-plugin": "^4.2.0", | ||
"husky": "^4.2.5", | ||
"jest": "^25.4.0", | ||
"lint-staged": "^10.1.7", | ||
"prettier": "^2.0.5", | ||
"react": "^16.13.1", | ||
"react-dom": "^16.13.1", | ||
"react-hot-loader": "^4.12.20", | ||
"semantic-release": "^17.0.7", | ||
"source-map-loader": "^0.2.4", | ||
"ts-jest": "^25.4.0", | ||
"typescript": "^3.8.3", | ||
"webpack": "^4.43.0", | ||
"webpack-cli": "^3.3.11", | ||
"webpack-dev-server": "^3.10.3" | ||
}, | ||
"browserslist": "last 2 versions", | ||
"dependencies": { | ||
"bootstrap": "^4.0.0-alpha.6", | ||
"jsdom-global": "^3.0.2", | ||
"prop-types": "^15.6.1", | ||
"react": "^16.0.0", | ||
"react-dom": "^16.0.0" | ||
"peerDependencies": { | ||
"react": "^16.9.0" | ||
}, | ||
"dependencies": {}, | ||
"jest": { | ||
"verbose": false, | ||
"collectCoverage": true, | ||
"setupFilesAfterEnv": [ | ||
"./.enzymerc.js" | ||
], | ||
"transform": { | ||
"^.+\\.tsx?$": "ts-jest" | ||
}, | ||
"testRegex": "(/__tests__/.*|(\\.|/)(test|spec))\\.(jsx?|tsx?)$", | ||
"moduleFileExtensions": [ | ||
"ts", | ||
"tsx", | ||
"js", | ||
"jsx" | ||
] | ||
}, | ||
"config": { | ||
"commitizen": { | ||
"path": "cz-conventional-changelog" | ||
} | ||
}, | ||
"husky": { | ||
"hooks": { | ||
"pre-commit": "yarn lint", | ||
"commit-msg": "commitlint -E HUSKY_GIT_PARAMS" | ||
} | ||
} | ||
} |
@@ -1,28 +0,74 @@ | ||
## React Currency Input Field | ||
# React Currency Input Field Component | ||
Quick project to create a React component for inputting currency | ||
[](https://www.npmjs.com/package/react-currency-input-field) [](https://www.npmjs.com/package/react-currency-input-field) [](https://codecov.io/gh/cchanxzy/react-currency-input-field/) [](https://github.com/cchanxzy/react-currency-input-field/actions?query=workflow%3ARelease) | ||
[Live Demo](https://chunkitchan.net/react-currency-input-field/) | ||
## Features | ||
### Install | ||
Install packages | ||
- Allows abbreviations eg. 1k = 1,000 2.5m = 2,500,000 | ||
- Prefix option eg. £ or \$ | ||
- Can allow/disallow decimals | ||
- Automatically inserts comma separator | ||
- Only allows valid numbers | ||
- Lightweight and simple | ||
``npm install`` | ||
## Demo | ||
### Development | ||
To run local server | ||
[Live Demo](https://cchanxzy.github.io/react-currency-input-field) | ||
``npm run start`` | ||
 | ||
View in browser: `localhost:3000` | ||
## Install | ||
Run tests: | ||
`npm install react-currency-input-field` | ||
``npm run test`` | ||
or | ||
### Production | ||
To build production | ||
`yarn add react-currency-input-field` | ||
``npm run build`` | ||
## Usage | ||
Everything is built in `/build` | ||
```js | ||
import CurrencyInput from 'react-currency-input-field'; | ||
<CurrencyInput | ||
id="input-example" | ||
name="input-name" | ||
placeholder="£1,000" | ||
defaultValue={1000} | ||
allowDecimals={true} | ||
decimalsLimit={2} | ||
onChange={(value, name) => console.log(value, name)} | ||
/>; | ||
``` | ||
Have a look in [`src/examples`](https://github.com/cchanxzy/react-currency-input-field/tree/master/src/examples) for more examples on implementing and validation. | ||
## Abbreviations | ||
It can parse values with abbreviations `k`, `m` and `b` | ||
Examples: | ||
- 1k = 1,000 | ||
- 2.5m = 2,500,000 | ||
- 3.456B = 3,456,000,000 | ||
## Props | ||
| Name | Type | Default | Description | | ||
| ------------- | ---------- | ------- | -------------------------------------------------------- | | ||
| allowDecimals | `boolean` | `true` | Allow decimals | | ||
| id | `string` | | Component id | | ||
| name | `string` | | Component (input) name | | ||
| className | `string` | | Class names | | ||
| decimalsLimit | `number` | `2` | Limit length of decimals allowed | | ||
| defaultValue | `number` | | Default value | | ||
| disabled | `boolean` | `false` | Disabled | | ||
| onChange | `function` | | Handle change in value. Value will be `null` or `number` | | ||
| placeholder | `string` | | Placeholder if no value | | ||
| prefix | `string` | | Include a prefix eg. £ or \$ | | ||
| maxLength | `number` | | Maximum characters the user can enter | | ||
## Issues | ||
Feel free to message me if you have any questions |
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
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
No website
QualityPackage does not have a website.
Found 1 instance in 1 package
1
0
75
0
34245
34
11
95
1
- Removedbootstrap@^4.0.0-alpha.6
- Removedjsdom-global@^3.0.2
- Removedprop-types@^15.6.1
- Removedreact@^16.0.0
- Removedreact-dom@^16.0.0
- Removed@asamuzakjp/css-color@2.8.3(transitive)
- Removed@csstools/color-helpers@5.0.2(transitive)
- Removed@csstools/css-calc@2.1.2(transitive)
- Removed@csstools/css-color-parser@3.0.8(transitive)
- Removed@csstools/css-parser-algorithms@3.0.4(transitive)
- Removed@csstools/css-tokenizer@3.0.3(transitive)
- Removedagent-base@7.1.3(transitive)
- Removedasynckit@0.4.0(transitive)
- Removedbootstrap@4.6.2(transitive)
- Removedcall-bind-apply-helpers@1.0.2(transitive)
- Removedcombined-stream@1.0.8(transitive)
- Removedcssstyle@4.2.1(transitive)
- Removeddata-urls@5.0.0(transitive)
- Removeddebug@4.4.0(transitive)
- Removeddecimal.js@10.5.0(transitive)
- Removeddelayed-stream@1.0.0(transitive)
- Removeddunder-proto@1.0.1(transitive)
- Removedentities@4.5.0(transitive)
- Removedes-define-property@1.0.1(transitive)
- Removedes-errors@1.3.0(transitive)
- Removedes-object-atoms@1.1.1(transitive)
- Removedes-set-tostringtag@2.1.0(transitive)
- Removedform-data@4.0.2(transitive)
- Removedfunction-bind@1.1.2(transitive)
- Removedget-intrinsic@1.3.0(transitive)
- Removedget-proto@1.0.1(transitive)
- Removedgopd@1.2.0(transitive)
- Removedhas-symbols@1.1.0(transitive)
- Removedhas-tostringtag@1.0.2(transitive)
- Removedhasown@2.0.2(transitive)
- Removedhtml-encoding-sniffer@4.0.0(transitive)
- Removedhttp-proxy-agent@7.0.2(transitive)
- Removedhttps-proxy-agent@7.0.6(transitive)
- Removediconv-lite@0.6.3(transitive)
- Removedis-potential-custom-element-name@1.0.1(transitive)
- Removedjquery@3.7.1(transitive)
- Removedjsdom@26.0.0(transitive)
- Removedjsdom-global@3.0.2(transitive)
- Removedlru-cache@10.4.3(transitive)
- Removedmath-intrinsics@1.1.0(transitive)
- Removedmime-db@1.52.0(transitive)
- Removedmime-types@2.1.35(transitive)
- Removedms@2.1.3(transitive)
- Removednwsapi@2.2.18(transitive)
- Removedparse5@7.2.1(transitive)
- Removedpopper.js@1.16.1(transitive)
- Removedpunycode@2.3.1(transitive)
- Removedreact-dom@16.14.0(transitive)
- Removedrrweb-cssom@0.8.0(transitive)
- Removedsafer-buffer@2.1.2(transitive)
- Removedsaxes@6.0.0(transitive)
- Removedscheduler@0.19.1(transitive)
- Removedsymbol-tree@3.2.4(transitive)
- Removedtldts@6.1.82(transitive)
- Removedtldts-core@6.1.82(transitive)
- Removedtough-cookie@5.1.2(transitive)
- Removedtr46@5.0.0(transitive)
- Removedw3c-xmlserializer@5.0.0(transitive)
- Removedwebidl-conversions@7.0.0(transitive)
- Removedwhatwg-encoding@3.1.1(transitive)
- Removedwhatwg-mimetype@4.0.0(transitive)
- Removedwhatwg-url@14.1.1(transitive)
- Removedws@8.18.1(transitive)
- Removedxml-name-validator@5.0.0(transitive)
- Removedxmlchars@2.2.0(transitive)