@canutin/svelte-currency-input 0.9.0 → 0.9.1

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.
@@ -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
@@ -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.0",
3
+ "version": "0.9.1",
4
4
  "exports": {
5
5
  "./package.json": "./package.json",
6
6
  ".": "./index.js",