Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
react-intl-currency-input
Advanced tools
Readme
A React component for i18n currency input using Intl API.
$ npm install react-intl-currency-input --save-dev
import React from "react"
import IntlCurrencyInput from "react-intl-currency-input"
const currencyConfig = {
locale: "pt-BR",
formats: {
number: {
BRL: {
style: "currency",
currency: "BRL",
minimumFractionDigits: 2,
maximumFractionDigits: 2,
},
},
},
};
const BrlCurrencyComponent = () => {
const handleChange = (event, value, maskedValue) => {
event.preventDefault();
console.log(value); // value without mask (ex: 1234.56)
console.log(maskedValue); // masked value (ex: R$1234,56)
};
return(
<IntlCurrencyInput currency="BRL" config={currencyConfig}
onChange={handleChange} />
);
}
export default BrlCurrencyComponent;
To run the example:
$ npm run example:start
And a new browser window will open at http://localhost:3000
Name | Type | Default | Description |
---|---|---|---|
defaultValue | number | 0 | Sets the default / initial value to be used by the component on the first load |
currency | string | USD | Sets the currency code |
config | object | USD related configuration | Configuration object compliant with react-intl intlShape |
autoFocus | boolean | false | Enables auto-focus when the component gets displayed |
autoSelect | boolean | false | Enables auto-select when the component gets displayed |
autoReset | boolean | false | Resets component's internal state when loses focus |
onChange | function | undefined | (event, value, maskedValued) => {} Exposes the Event itself, the value with no mask and maskedValue for displaying purposes |
onFocus | function | undefined | (event, value, maskedValued) => { Called when the component gains focus |
onBlur | function | undefined | (event, value, maskedValued) => { Called when the component loses focus |
onKeyPress | function | undefined | (event, key, keyCode) => {} Called when a key is pressed |
max | number | undefined | Maximum value for the input. Input does not change if the value is greater than max |
All the other undocumented properties available for any React Component
should also be available.
FAQs
A React component for i18n currency input using the Intl API.
The npm package react-intl-currency-input receives a total of 2,758 weekly downloads. As such, react-intl-currency-input popularity was classified as popular.
We found that react-intl-currency-input demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.