Skip to content

Commit

Permalink
Merge pull request #96 from cchanxzy/chore/update-beta-branch-with-ma…
Browse files Browse the repository at this point in the history
…ster

Chore/update beta branch with master
  • Loading branch information
cchanxzy authored Nov 19, 2020
2 parents 7798646 + 02c7526 commit 3c4c519
Show file tree
Hide file tree
Showing 46 changed files with 2,195 additions and 846 deletions.
22 changes: 22 additions & 0 deletions .github/stale.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Number of days of inactivity before an issue becomes stale
daysUntilStale: 60

# Number of days of inactivity before a stale issue is closed
daysUntilClose: 7

# Issues with these labels will never be considered stale
exemptLabels:
- pinned
- security

# Label to use when marking an issue as stale
staleLabel: wontfix

# Comment to post when marking an issue as stale. Set to `false` to disable
markComment: >
This issue has been automatically marked as stale because it has not had
recent activity. It will be closed if no further activity occurs. Thank you
for your contributions.
# Comment to post when closing a stale issue. Set to `false` to disable
closeComment: false
32 changes: 32 additions & 0 deletions .github/workflows/examples.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Examples
on:
push:
branches:
- master
jobs:
release:
name: Release
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v1
- name: Setup Node.js
uses: actions/setup-node@v1
with:
node-version: 12
- name: Cache node modules
uses: actions/cache@v1
with:
path: node_modules
key: ${{ runner.OS }}-build-${{ hashFiles('yarn.lock') }}
- name: Install dependencies
run: yarn
- name: Build examples
run: yarn gh-predeploy
- name: Deploy to GitHub Pages
uses: JamesIves/github-pages-deploy-action@3.6.2
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BRANCH: gh-pages
FOLDER: demo/examples
CLEAN: true
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
node_modules
coverage
.vscode
dist
dist
demo/examples
9 changes: 9 additions & 0 deletions .releaserc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,13 @@
},
],
],
'branches':
[
'+([0-9])?(.{+([0-9]),x}).x',
'master',
'next',
'next-major',
{ name: 'beta', prerelease: true },
{ name: 'alpha', prerelease: true },
],
}
96 changes: 96 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,99 @@
# [2.7.0](https://github.com/cchanxzy/react-currency-input-field/compare/v2.6.0...v2.7.0) (2020-11-18)


### Features

* can turn off abbreviations ([67a54c1](https://github.com/cchanxzy/react-currency-input-field/commit/67a54c1288d0fded0fed1f4ef751073eb44a73cb))

# [2.6.0](https://github.com/cchanxzy/react-currency-input-field/compare/v2.5.0...v2.6.0) (2020-11-15)


### Features

* handle arrow down and arrow up step changes ([31e6156](https://github.com/cchanxzy/react-currency-input-field/commit/31e61561087bd95bdfb4763d3caa7b91df28ae23))

# [2.5.0](https://github.com/cchanxzy/react-currency-input-field/compare/v2.4.1...v2.5.0) (2020-11-11)


### Features

* export format value function and add to readme ([cad0b95](https://github.com/cchanxzy/react-currency-input-field/commit/cad0b958e5494160d0a65f065516496a72a9e8ad))

## [2.4.1](https://github.com/cchanxzy/react-currency-input-field/compare/v2.4.0...v2.4.1) (2020-11-04)


### Bug Fixes

* add onChange to onBlur test ([4195ef6](https://github.com/cchanxzy/react-currency-input-field/commit/4195ef68c5e2eeaedd573813b252dacf4b8b2e92))

# [2.4.0](https://github.com/cchanxzy/react-currency-input-field/compare/v2.3.6...v2.4.0) (2020-11-03)


### Features

* add prop onBlurValue ([7ea46af](https://github.com/cchanxzy/react-currency-input-field/commit/7ea46af02310e45d0df9ee2b4810958f22c30f98))

## [2.3.6](https://github.com/cchanxzy/react-currency-input-field/compare/v2.3.5...v2.3.6) (2020-11-03)


### Bug Fixes

* escape prefix regex ([8e0dff5](https://github.com/cchanxzy/react-currency-input-field/commit/8e0dff5cf7314099c5bb15e0ac63c5e6c4da106b))

## [2.3.5](https://github.com/cchanxzy/react-currency-input-field/compare/v2.3.4...v2.3.5) (2020-10-28)


### Bug Fixes

* handle values before prefix ([942a613](https://github.com/cchanxzy/react-currency-input-field/commit/942a613a3b98890cbef9ed62eb7df2f1c62c91e9))

## [2.3.4](https://github.com/cchanxzy/react-currency-input-field/compare/v2.3.3...v2.3.4) (2020-10-24)


### Bug Fixes

* refactored isNumber function ([68640ff](https://github.com/cchanxzy/react-currency-input-field/commit/68640fffa8ef0b36c3f3a9d2bb93d6abfa4814f1))

## [2.3.3](https://github.com/cchanxzy/react-currency-input-field/compare/v2.3.2...v2.3.3) (2020-10-10)


### Bug Fixes

* allows default 0 value ([4189b80](https://github.com/cchanxzy/react-currency-input-field/commit/4189b80b5949dfe662add54e8953301e1b7c9912))
* disallow invalid chars and updated examples ([134d36a](https://github.com/cchanxzy/react-currency-input-field/commit/134d36a098a4f3fcb87429ee55c32543cabfcc46))
* don't call onChange with only - ([ef4101b](https://github.com/cchanxzy/react-currency-input-field/commit/ef4101bca97b629f6e412b728456642fa0ebf231))

## [2.3.2](https://github.com/cchanxzy/react-currency-input-field/compare/v2.3.1...v2.3.2) (2020-09-27)


### Bug Fixes

* prefix 0 value ([d7fa074](https://github.com/cchanxzy/react-currency-input-field/commit/d7fa0747f09da9a33bb46146172563277a1b5fc3))

## [2.3.1](https://github.com/cchanxzy/react-currency-input-field/compare/v2.3.0...v2.3.1) (2020-09-25)


### Bug Fixes

* can clear field programmatically ([2598c16](https://github.com/cchanxzy/react-currency-input-field/commit/2598c16dc1ea499110740c6b63deb48d40c597e6))

# [2.3.0](https://github.com/cchanxzy/react-currency-input-field/compare/v2.2.0...v2.3.0) (2020-09-20)


### Features

* add prop to disallow negative value ([b9ef02c](https://github.com/cchanxzy/react-currency-input-field/commit/b9ef02ca489833fcc95a25148cee1e7b7ade132d))

# [2.2.0](https://github.com/cchanxzy/react-currency-input-field/compare/v2.1.0...v2.2.0) (2020-08-25)


### Features

* add props decimalSeparator and groupSeparator ([bb4459b](https://github.com/cchanxzy/react-currency-input-field/commit/bb4459b87835aa91ca834a4bc566608232d3c545))
* can use any string as a separator ([c84b1cd](https://github.com/cchanxzy/react-currency-input-field/commit/c84b1cd5fbcfd3cd5f13afddee8ed8de95b4d2db))
* fixed decimal length prop ([f3f50a1](https://github.com/cchanxzy/react-currency-input-field/commit/f3f50a171a8083cf2daa41bc1f544293abd3436b))
* handle negative values ([b505e4c](https://github.com/cchanxzy/react-currency-input-field/commit/b505e4c606a215866fa4449f1973add03c8469e7))

# [2.2.0-beta.3](https://github.com/cchanxzy/react-currency-input-field/compare/v2.2.0-beta.2...v2.2.0-beta.3) (2020-08-25)


Expand Down
63 changes: 42 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@
- Only allows valid numbers
- Lightweight and simple

## Demo
## Examples

[Live Demo](https://cchanxzy.github.io/react-currency-input-field)
[Play with demo](https://cchanxzy.github.io/react-currency-input-field) or view [examples code](https://github.com/cchanxzy/react-currency-input-field/blob/master/src/examples)

![React Currency Input Demo](demo/demo.gif)
[![React Currency Input Demo](demo/demo.gif)](https://cchanxzy.github.io/react-currency-input-field)

## Install

Expand Down Expand Up @@ -89,24 +89,45 @@ Example if `fixedDecimalLength` was 2:

## Props

| Name | Type | Default | Description |
| ------------------ | ---------- | ------- | ------------------------------------------------------------------------ |
| allowDecimals | `boolean` | `true` | Allow decimals |
| className | `string` | | Class names |
| decimalsLimit | `number` | `2` | Limit length of decimals allowed |
| defaultValue | `number` | | Default value |
| disabled | `boolean` | `false` | Disabled |
| fixedDecimalLength | `number` | | Value will always have the specified length of decimals |
| id | `string` | | Component id |
| maxLength | `number` | | Maximum characters the user can enter |
| onChange | `function` | | Handle change in value |
| placeholder | `string` | | Placeholder if no value |
| precision | `number` | | Specify decimal precision for padding/trimming |
| prefix | `string` | | Include a prefix eg. £ or \$ |
| decimalSeparator | `string` | `.` | Separator between integer part and fractional part of value |
| groupSeparator | `string` | `,` | Separator between thousand, million and billion |
| turnOffSeparators | `boolean` | `false` | Disable auto adding the group separator between values, eg. 1000 > 1,000 |
| Name | Type | Default | Description |
| -------------------- | ---------- | ------- | ------------------------------------------------------------------------ |
| allowDecimals | `boolean` | `true` | Allow decimals |
| allowNegativeValue | `boolean` | `true` | Allow user to enter negative value |
| className | `string` | | Class names |
| decimalsLimit | `number` | `2` | Limit length of decimals allowed |
| defaultValue | `number` | | Default value |
| value | `number` | | Programmatically set the value |
| disabled | `boolean` | `false` | Disabled |
| fixedDecimalLength | `number` | | Value will always have the specified length of decimals |
| id | `string` | | Component id |
| maxLength | `number` | | Maximum characters the user can enter |
| onChange | `function` | | Handle change in value |
| onBlurValue | `function` | | Handle value onBlur |
| placeholder | `string` | | Placeholder if no value |
| precision | `number` | | Specify decimal precision for padding/trimming |
| prefix | `string` | | Include a prefix eg. £ or \$ |
| step | `number` | | Incremental value change on arrow down and arrow up key press |
| decimalSeparator | `string` | `.` | Separator between integer part and fractional part of value |
| groupSeparator | `string` | `,` | Separator between thousand, million and billion |
| turnOffAbbreviations | `boolean` | `false` | Disable abbreviations eg. 1k > 1,000, 2m > 2,000,000 |
| turnOffSeparators | `boolean` | `false` | Disable auto adding the group separator between values, eg. 1000 > 1,000 |

## Format values for display

Use the `formatValue` function to format the values to a more user friendly string. This is useful if you are displaying the value somewhere else ie. the total of multiple inputs.

```javascript
import { formatValue } from 'react-currency-input-field';

const formattedValue = formatValue({
value = 123456,
groupSeparator = ',',
decimalSeparator = '.',
turnOffSeparators = false,
prefix = '$',
});
```

## Issues

Feel free to message me if you have any questions
Feel free to raise an issue on Github if you find a bug or have a feature request
12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
{
"name": "react-currency-input-field",
"version": "2.2.0-beta.3",
"version": "2.7.0",
"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",
"homepage": "https://github.com/cchanxzy/react-currency-input-field",
"scripts": {
"build": "rm -rf dist && tsc && NODE_ENV='prod' webpack --mode=production",
"start": "NODE_ENV='dev' webpack-dev-server --mode=development --hot",
"build": "rm -rf dist && tsc && NODE_ENV='production' webpack --config-name=prod --mode=production",
"start": "NODE_ENV='development' webpack-dev-server --config-name=dev --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",
"gh-predeploy": "NODE_ENV='production' webpack --config-name=dev --mode=production",
"gh-deploy": "yarn gh-predeploy && gh-pages -d demo/examples",
"ci": "yarn && yarn build",
"codecov": "codecov",
"semantic-release": "semantic-release"
Expand Down
Loading

0 comments on commit 3c4c519

Please sign in to comment.