You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Redo MoneyInput (better UX, less error cases) (#175)
* feat(money-input): reduce to hasError and hasWarning
BREAKING CHANGE: dropped support for hasAmountError, hasAmountWarning, hasCurrencyError and hasCurrencyWarning. Use hasError and hasWarning instead.
BREAKING CHANGE: isTouched only returns true when both fields were touched from now on.
* feat(money-field): mark both fields as touched when one of them loses focus
We only mark both as blurred when an element which is not part of the MoneyInput gains focus. This is done to ensure the MoneyInput acts as one unit so that errors can be displayed correctly (as they rely on both touched states and would pop up too early if only one of them is checked).
This also auto-focuses the amount intput after a currency has been selected.
* test(money-input): switch tests to react-testing-library
* docs(money-input): fix leftover areAllTouched
Copy file name to clipboardexpand all lines: src/components/inputs/money-input/README.md
+18-5
Original file line number
Diff line number
Diff line change
@@ -41,10 +41,8 @@ The amount can have an arbitrary precision. When the precision of the amount exc
41
41
|`isDisabled`|`bool`| - | - |`false`| Indicates that the field cannot be used. |
42
42
|`onBlur`|`func`| - | - | - | Called when the amount field or the currency code dropdown is blurred. |
43
43
|`onChange`|`function(event)`| ✳️ | - | - | Called with the event of the input or dropdown when either the currency or the amount have changed. Either `onChange` or `onChangeValue` must be passed. |
44
-
|`hasCurrencyError`|`bool`| - | - | - | Indicates if the currency field has an error |
45
-
|`hasCurrencyWarning`|`bool`| - | - | - | Indicates if the currency field has a warning |
46
-
|`hasAmountError`|`bool`| - | - | - | Indicates if the centAmount field has an error |
47
-
|`hasAmountWarning`|`bool`| - | - | - | Indicates if the centAmount field has a warning |
44
+
|`hasError`|`bool`| - | - | - | Indicates if the input has an error |
45
+
|`hasWarning`|`bool`| - | - | - | Indicates if the input has a warning |
48
46
|`horizontalConstraint`|`string`| - |`s`, `m`, `l`, `xl`, `scale`|`scale`| Horizontal size limit of the input fields. |
0 commit comments