From a6fcd6c95c3e3634e2da2cddba3239a49f8fe3ba Mon Sep 17 00:00:00 2001 From: Sienna Svob Date: Thu, 11 Apr 2019 16:21:49 -0400 Subject: [PATCH 1/3] react/DP-13450--Fix-InputCurrency-OnBlurBug (#533) * react/DP-13450--Fix-InputCurrency-OnBlurBug * add changelog * Update react/src/components/atoms/forms/InputCurrency/index.js --- changelogs/DP-13450.md | 3 +++ .../components/atoms/forms/InputCurrency/index.js | 12 ++++-------- 2 files changed, 7 insertions(+), 8 deletions(-) create mode 100644 changelogs/DP-13450.md diff --git a/changelogs/DP-13450.md b/changelogs/DP-13450.md new file mode 100644 index 0000000000..1ebf62f251 --- /dev/null +++ b/changelogs/DP-13450.md @@ -0,0 +1,3 @@ +Patch +Fixed +- (React) [InputCurrency] DP-13450: Fixed bug relating to error handling on blur in InputCurrency. #533 \ No newline at end of file diff --git a/react/src/components/atoms/forms/InputCurrency/index.js b/react/src/components/atoms/forms/InputCurrency/index.js index 2e8d8e4d30..f4c4ad383c 100644 --- a/react/src/components/atoms/forms/InputCurrency/index.js +++ b/react/src/components/atoms/forms/InputCurrency/index.js @@ -24,7 +24,6 @@ const Currency = (props) => { 'ma__input-currency__control': true, 'js-is-required': props.required }); - let errorMsg = ''; const toCurrency = (number, decimal) => { if (is.number(number)) { if (props.language) { @@ -146,17 +145,14 @@ const Currency = (props) => { inputEl.setAttribute('placeholder', props.placeholder); } let newValue = isNotNumber ? '' : Number(numbro.unformat(stringValue)); - if (props.required && is.empty(stringValue)) { - errorMsg = 'Please enter a value.'; - context.updateState({ showError: true, errorMsg }); - } else if (!is.empty(stringValue)) { - if (!hasNumberProperty(props, 'max') || newValue > props.max) { + if (!is.empty(newValue)) { + if (hasNumberProperty(props, 'max') && newValue > props.max) { newValue = props.max; } - if (!hasNumberProperty(props, 'min') || newValue < props.min) { + if (hasNumberProperty(props, 'min') && newValue < props.min) { newValue = props.min; } - const updateError = displayErrorMessage(!is.empty(stringValue) ? newValue : ''); + const updateError = displayErrorMessage(newValue); context.updateState({ value: toCurrency(newValue, countDecimals(props.step)), ...updateError }, () => { if (is.fn(props.onBlur)) { props.onBlur(newValue); From e2adbf066ed9a1ef45cc6c39eb1edc71e5fbed5d Mon Sep 17 00:00:00 2001 From: Minghua Sun Date: Thu, 11 Apr 2019 16:42:29 -0400 Subject: [PATCH 2/3] add readme for windows users (#534) * add readme for windows users * add changelog * Update react/README.md --- changelogs/react-readme.md | 4 ++++ react/README.md | 10 ++++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) create mode 100644 changelogs/react-readme.md diff --git a/changelogs/react-readme.md b/changelogs/react-readme.md new file mode 100644 index 0000000000..68e573fee0 --- /dev/null +++ b/changelogs/react-readme.md @@ -0,0 +1,4 @@ +___EXAMPLE___ +Patch +Added +- (React) [README] Add documentation for creating assets symlink for Windows bash users. #534 diff --git a/react/README.md b/react/README.md index 9c145947f3..97df6723f4 100644 --- a/react/README.md +++ b/react/README.md @@ -22,10 +22,16 @@ For a guide and information on the components included in mayflower-react and th * `npm install` * `npm start`: This will run the demo application. +Please note that we are currently relying on symlink for pulling in shared assets into react source code. For Windows users, you need to manually create the symlink before running `npm start`. +e.g. In cmd prompt: +- $ `cd src` - make sure you are in the `src` folder in `mayflower/react` +- $ `rm assets` +- $ `ln -s ../../assets assets` + #### System Requirements -- node.js, currently standardized on version 8.9.4 -- npm, currently standardized on version 5.6.0 +- node.js, currently standardized on version 10.15.1 +- npm, currently standardized on version 6.4.1 - That's it! All other dependencies should be included when you run ``npm i``. #### Useful commands From 04ba40b208b717d998df7b20e28a55fe36192e29 Mon Sep 17 00:00:00 2001 From: avrilpearl Date: Thu, 11 Apr 2019 16:44:27 -0400 Subject: [PATCH 3/3] consolidate changelog --- CHANGELOG.md | 5 +++++ changelogs/DP-13450.md | 3 --- changelogs/react-readme.md | 4 ---- 3 files changed, 5 insertions(+), 7 deletions(-) delete mode 100644 changelogs/DP-13450.md delete mode 100644 changelogs/react-readme.md diff --git a/CHANGELOG.md b/CHANGELOG.md index 0866afcfae..b8ce17f56f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,11 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) **For example** - DP-1234: The short description text on a [service detail](http://mayflower.digital.mass.gov/?p=pages-detail-for-service-howto-location) page banner ([@organisms/by-template/page-banner](http://mayflower.digital.mass.gov/?p=organisms-page-banner)) should now render ([PR #493](https://github.com/massgov/mayflower/pull/493)) +## 9.4.2 (04/10/2019) + +### Fixed +- (React) [InputCurrency] DP-13450: Fixed bug relating to error handling on blur in InputCurrency. #533 + ## 9.4.1 (04/10/2019) ### Fixed diff --git a/changelogs/DP-13450.md b/changelogs/DP-13450.md deleted file mode 100644 index 1ebf62f251..0000000000 --- a/changelogs/DP-13450.md +++ /dev/null @@ -1,3 +0,0 @@ -Patch -Fixed -- (React) [InputCurrency] DP-13450: Fixed bug relating to error handling on blur in InputCurrency. #533 \ No newline at end of file diff --git a/changelogs/react-readme.md b/changelogs/react-readme.md deleted file mode 100644 index 68e573fee0..0000000000 --- a/changelogs/react-readme.md +++ /dev/null @@ -1,4 +0,0 @@ -___EXAMPLE___ -Patch -Added -- (React) [README] Add documentation for creating assets symlink for Windows bash users. #534