@canutin/svelte-currency-input 0.9.0 → 0.9.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CurrencyInput.svelte +2 -1
- package/README.md +2 -1
- package/package.json +4 -4
package/CurrencyInput.svelte
CHANGED
|
@@ -94,7 +94,6 @@ const setUnformattedValue = (event) => {
|
|
|
94
94
|
}
|
|
95
95
|
}
|
|
96
96
|
}
|
|
97
|
-
onValueChange(value);
|
|
98
97
|
};
|
|
99
98
|
const setFormattedValue = () => {
|
|
100
99
|
// Previous caret position
|
|
@@ -111,6 +110,8 @@ const setFormattedValue = () => {
|
|
|
111
110
|
setTimeout(() => {
|
|
112
111
|
inputTarget?.setSelectionRange(endCaretPosition, endCaretPosition);
|
|
113
112
|
}, 0.1);
|
|
113
|
+
// Run callback function when `value` changes
|
|
114
|
+
onValueChange(value);
|
|
114
115
|
};
|
|
115
116
|
let formattedValue = '';
|
|
116
117
|
let formattedPlaceholder = placeholder !== null ? formatCurrency(placeholder, fractionDigits, fractionDigits) : '';
|
package/README.md
CHANGED
|
@@ -20,7 +20,7 @@ A form input that converts numbers to localized currency formats as you type
|
|
|
20
20
|
## Usage
|
|
21
21
|
|
|
22
22
|
```bash
|
|
23
|
-
npm install svelte-currency-input --save
|
|
23
|
+
npm install @canutin/svelte-currency-input --save
|
|
24
24
|
```
|
|
25
25
|
|
|
26
26
|
```html
|
|
@@ -70,6 +70,7 @@ This is more or less what `<CurrencyInput />` looks like under the hood:
|
|
|
70
70
|
| isNegativeAllowed | `boolean` | `true` | If `false`, forces formatting only to positive values and ignores `--positive` and `--negative` styling modifiers |
|
|
71
71
|
| fractionDigits | `number` | `2` | Sets `maximumFractionDigits` in [`Intl.NumberFormat()` constructor](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat/NumberFormat#minimumfractiondigits) used for formatting the currency. Supported digits: `0` to `20` |
|
|
72
72
|
| inputClasses | `object` | [See below](#Styling) | Selectively overrides any class names passed |
|
|
73
|
+
| onValueChange | `Callback` | `undefined` | Runs a callback function after the value changes |
|
|
73
74
|
|
|
74
75
|
## Styling
|
|
75
76
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@canutin/svelte-currency-input",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.2",
|
|
4
4
|
"exports": {
|
|
5
5
|
"./package.json": "./package.json",
|
|
6
6
|
".": "./index.js",
|
|
@@ -39,13 +39,13 @@
|
|
|
39
39
|
],
|
|
40
40
|
"repository": {
|
|
41
41
|
"type": "git",
|
|
42
|
-
"url": "git+https://github.com/
|
|
42
|
+
"url": "git+https://github.com/fmaclen/svelte-currency-input.git"
|
|
43
43
|
},
|
|
44
44
|
"author": "Fernando Maclen <hello@fernando.is>",
|
|
45
45
|
"license": "MIT",
|
|
46
46
|
"bugs": {
|
|
47
|
-
"url": "https://github.com/
|
|
47
|
+
"url": "https://github.com/fmaclen/svelte-currency-input/issues"
|
|
48
48
|
},
|
|
49
|
-
"homepage": "https://github.com/
|
|
49
|
+
"homepage": "https://github.com/fmaclen/svelte-currency-input#readme",
|
|
50
50
|
"svelte": "./index.js"
|
|
51
51
|
}
|