react-currency-input-field
Advanced tools
Comparing version 3.0.0-beta.10 to 3.0.0-beta.11
@@ -0,1 +1,3 @@ | ||
# [3.0.0-beta.11](https://github.com/cchanxzy/react-currency-input-field/compare/v3.0.0-beta.10...v3.0.0-beta.11) (2021-01-04) | ||
# [3.0.0-beta.10](https://github.com/cchanxzy/react-currency-input-field/compare/v3.0.0-beta.9...v3.0.0-beta.10) (2021-01-02) | ||
@@ -2,0 +4,0 @@ |
@@ -47,3 +47,3 @@ import { Ref, ElementType } from 'react'; | ||
* | ||
* Eg. 1 -> 1.99 or 1.234 -> 1.23 | ||
* Eg. 1.5 -> 1.50 or 1.234 -> 1.23 | ||
*/ | ||
@@ -50,0 +50,0 @@ decimalScale?: number; |
{ | ||
"name": "react-currency-input-field", | ||
"version": "3.0.0-beta.10", | ||
"version": "3.0.0-beta.11", | ||
"description": "React <input/> component for formatting currency and numbers.", | ||
@@ -5,0 +5,0 @@ "files": [ |
@@ -63,5 +63,4 @@ # React Currency Input Field Component | ||
name="input-name" | ||
placeholder="£1,000" | ||
placeholder="Please enter a number" | ||
defaultValue={1000} | ||
allowDecimals={true} | ||
decimalsLimit={2} | ||
@@ -76,24 +75,22 @@ onValueChange={(value, name) => console.log(value, name)} | ||
| Name | Type | Default | Description | | ||
| ---------------------- | ---------- | -------------- | -------------------------------------------------------------------------------------------- | | ||
| allowDecimals | `boolean` | `true` | Allow decimals | | ||
| allowNegativeValue | `boolean` | `true` | Allow user to enter negative value | | ||
| className | `string` | | Class names | | ||
| defaultValue | `number` | | Default value | | ||
| value | `number` | | Programmatically set the value | | ||
| onValueChange | `function` | | Handle change in value | | ||
| placeholder | `string` | | Placeholder if no value | | ||
| id | `string` | | Component id | | ||
| decimalsLimit | `number` | `2` | Limit length of decimals allowed | | ||
| decimalScale | `number` | | Specify decimal scale for padding/trimming eg. 1 -> 1.99 or 1.234 -> 1.23 if decimal scale 2 | | ||
| fixedDecimalLength | `number` | | Value will always have the specified length of decimals | | ||
| prefix | `string` | | Include a prefix eg. £ or \$ | | ||
| decimalSeparator | `string` | locale default | Separator between integer part and fractional part of value | | ||
| groupSeparator | `string` | locale default | Separator between thousand, million and billion | | ||
| intlConfig | `object` | | International locale config | | ||
| disabled | `boolean` | `false` | Disabled | | ||
| disableAbbreviations | `boolean` | `false` | Disable abbreviations eg. 1k -> 1,000, 2m -> 2,000,000 | | ||
| disableGroupSeparators | `boolean` | `false` | Disable auto adding the group separator between values, eg. 1000 -> 1,000 | | ||
| maxLength | `number` | | Maximum characters the user can enter | | ||
| step | `number` | | Incremental value change on arrow down and arrow up key press | | ||
| Name | Type | Default | Description | | ||
| ---------------------- | ---------- | -------------- | ---------------------------------------------------------------------------------------------- | | ||
| allowDecimals | `boolean` | `true` | Allow decimals | | ||
| allowNegativeValue | `boolean` | `true` | Allow user to enter negative value | | ||
| defaultValue | `number` | | Default value | | ||
| value | `number` | | Programmatically set the value | | ||
| onValueChange | `function` | | Handle change in value | | ||
| placeholder | `string` | | Placeholder if no value | | ||
| decimalsLimit | `number` | `2` | Limit length of decimals allowed | | ||
| decimalScale | `number` | | Specify decimal scale for padding/trimming eg. 1.5 -> 1.50 or 1.234 -> 1.23 if decimal scale 2 | | ||
| fixedDecimalLength | `number` | | Value will always have the specified length of decimals | | ||
| prefix | `string` | | Include a prefix eg. £ or \$ | | ||
| decimalSeparator | `string` | locale default | Separator between integer part and fractional part of value | | ||
| groupSeparator | `string` | locale default | Separator between thousand, million and billion | | ||
| intlConfig | `object` | | International locale config | | ||
| disabled | `boolean` | `false` | Disabled | | ||
| disableAbbreviations | `boolean` | `false` | Disable abbreviations eg. 1k -> 1,000, 2m -> 2,000,000 | | ||
| disableGroupSeparators | `boolean` | `false` | Disable auto adding the group separator between values, eg. 1000 -> 1,000 | | ||
| maxLength | `number` | | Maximum characters the user can enter | | ||
| step | `number` | | Incremental value change on arrow down and arrow up key press | | ||
@@ -167,4 +164,6 @@ ### Abbreviations | ||
`decimalsLimit` and `decimalScale` are similar, the difference is `decimalsLimit` prevents the user from typing more than the limit, and `decimalScale` will format decimals `onBlur` to the specified length. | ||
`decimalsLimit` and `decimalScale` are similar, the difference is `decimalsLimit` prevents the user from typing more than the limit, and `decimalScale` will format the decimals `onBlur` to the specified length, padding or trimming as necessary. | ||
Example: If decimal scale 2, 1.5 -> 1.50 and 1.234 -> 1.23 | ||
## Format values for display | ||
@@ -185,4 +184,4 @@ | ||
console.log(formattedValue1); | ||
// $123,456 | ||
console.log(formattedValue1); | ||
@@ -195,4 +194,4 @@ // Format using intl locale config | ||
console.log(formattedValue2); | ||
// ₹5,00,000 | ||
console.log(formattedValue2); | ||
``` | ||
@@ -199,0 +198,0 @@ |
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
87006
224